简体   繁体   中英

Can I get the javac command equivalent to an Eclipse export to JAR for a project (or NetBeans)?

I have the following task at hand: I have a Java project in Eclipse on machineA that I need to run on machineB . These machines are similar but different and I am getting an error trying to run on B the JAR that I exported on A . So what I want to do it to try rebuilding my code on B . Now, a standard way to do that would be to set up the project on A as an Ant or Maven build, copy the project to B and then run Ant/Maven on B from command line (I don't have Eclipse installed on B ). However, B is a bit... "special" in different ways. For instance, its default java is 1.6 but it also has a local install of 1.7 that I am using. That install has both java and javac . There is no Maven there at all and there is a custom Ant install that may not correspond to the java install.

So the question is: is there a way to generate the javac command that would be used on A to export to JAR, so that I could run that command from the command line, possibly with some mods, to (re)build the project on B ?

UPDATE: Would it be easier to do the same in Netbeans? If so, I would be willing to give it a try.

I think what you want is the jar command, as opposed to a javac option. The jar command, part of the Java JDK, creates a jar file for you. There is documentation here .

But this will create the same jar that eclipse will create, so I expect there is some problem running it on your B machine that does not have to do, strictly, with creating jar files. So more detail on the problem you're having on B would help.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM