Pregunta

I'm following this tutorial on how to build an Android Plugin for Unity

I'm currently at the part where the author tells me to do the following in command line:

1.> javac CompassActivity.java -classpath C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\androidplayer\bin\classes.jar -bootclasspath C:\android-sdk-windows\platforms\android-8\android.jar -d .

2.> javap -s com.yourcompany.yourgamename.CompassActivity

3.> jar cvfM ../Compass.jar com/

However when I type the following line:

javac CompassActivity.java -classpath C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\androidplayer\bin\classes.jar

I get the following message:

javac: invalid flags: (x86)\Unity\Editor\Data\PlaybackEngines\androidplayer\bin\classes.jar
usage: javac <options> <source files>
use -help for a list of possible options

So I've tried retyping the line putting my path of the file in angled brackets, placing a dot in between classpath and the start of my file location, but I keep getting the same issue.

Am I using classpath wrong?

If so, what is the correct way I should be doing it?

I should add that the console does point to the correct folder location. That was the first thing I've checked.

¿Fue útil?

Solución

There are spaces in the path to classes.jar, you must enclose it using ", or shell will consider it as three distinct parameters (C:\Program, Files and (x86)\Unity\Editor\Data\PlaybackEngines\androidplayer\bin\classes.jar"):

javac CompassActivity.java -classpath "C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\androidplayer\bin\classes.jar"

Otros consejos

You must try the command like:

usage: javac <options> <source files>

javac -classpath "C:\Program Files (x86)\Unity\Editor\Data\PlaybackEngines\androidplayer\bin\classes.jar" CompassActivity.java

First Check your System is 32-bit or 64-bit

check it out full steps for Config and run:http://introcs.cs.princeton.edu/java/15inout/windows-cmd.html

USe

javac -cp filepath 

or you also try to set the classpath first by command

set classpath="filepath"

Then u can try with a command

java filepath
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top