My build config:
{
“cmd”:“javac -d /home/bai/BaseLays/bin -sourcepath src $file && java -classpath ./bin $file_base_name”,
“file_regex”: “^[ ]File "(…?)”, line ([0-9]*)",
“path”:"/home/bai/Programs/jdk1.8.0_241/bin/",
“selector”: “source.java”,
“shell”:true
}
Тhe compilation is successful, but the interpretation is not, java needs the full class name. If I launch from the terminal java -classpath ./bin full_name_class_file it works! Help pls.
Java build. Need full name class for run
you may find variables in https://www.sublimetext.com/docs/3/build_systems.html#variables. maybe there is something useful.
You say running java -classpath ./bin full_name_class_file
works. Is your file named full_name_class_file
?
No no. My file name Main.java, it successfully compiles in Main.class. To run Main.class from the shell, you must specify the full name of the class.
Structure project:
----BaseLays
------bin
------src
----------com
----------------base
----------------------math
-----------------------------Main.class
Main.class has name package com.base.math. He run from shell java -cp . com.base.math.Main
That’s the name you need to put in the config.
Well there’s no build system variable for the java fully qualified class name, so your only option is to hard-code the class in this case. Either that or use a proper build system like gradle, a shell script or something to compile/run your code without needing to specify the fully qualified class name.