Home > Back-end >  In Linux compile time how to specify the dependent classes and jar?
In Linux compile time how to specify the dependent classes and jar?

Time:09-22

Think on their own centos I compile my idea of the project, the code is no problem, the idea of compiling is normal, but it can't compile on centos, what reason is this excuse me?

CodePudding user response:

Compile
Javac - cp.; . \ lib \ myTool. Jar; . \ lib \ myTool2. Jar - d. Helloworld. Java

Run
java -cp .; . \ lib \ myTool. Jar; . \ lib \ myTool2. Jar com. SXZ. The Helloworld

It doesn't make much difference whether and Linux!
https://blog.csdn.net/sxzlc/article/details/104910162


CodePudding user response:

In the environment variable path specified

CodePudding user response:

refer to the second floor response:
environment variable is the path of the specified

The path of the global variable? Pointing to the javahome/bin, still need to change this?
I introduced the jar package seems to be specified in the above normal, but in class or can't find other bag, don't know what is reference

CodePudding user response:

Don't know much about it, not under Linux make the Java command, but on the power shell try it, you try on the command line with quotes,

CodePudding user response:


Javac - cp ".; . \ lib \ myTool. Jar; . \ lib \ myTool2. Jar "- d. Helloworld. Java
Java - cp ".; . \ lib \ myTool. Jar; . \ lib \ myTool2. Jar "com. The SXZ. The Helloworld

CodePudding user response:

Should have nothing to do with the path, right path, the command is unable to perform,
  • Related