I'm working with JShop2 GitHub. I'm having trouble with the installation; it says:
After unzipping the JSHOP2 zipped file in any directory, set the
CLASSPATH environment variable to include (replacing JSHOP2_DIRECTORY
with the directory where JSHOP2 is unzipped):
in Windows: JSHOP2_DIRECTORY\bin\antlr.jar;JSHOP2_DIRECTORY\bin\JSHOP2.jar;
How can I set these environmental variables? I don't have bin folder as shown in the path --> JSHOP2_DIRECTORY\bin\
I just read that i need to compile src to get bin folder, but I don't know how to do that. Please help.
You can still add the environmental variables even if the bin folder doesn't exist yet. Just make sure you restart your command prompt after you added the new environmental variables, for them to be picked up.
As for building the source in Windows, looking at the readme, their make.bat seems to be missing. You can create an issue in github to notify them. Meanwhile, you can use something like MinGW to run make on Windows.
After installing MinGW, you may have to execute
copy c:\MinGW\bin\mingw32-make.exe c:\MinGW\bin\make.exe
if make.exe didn't get created during the installation. Then you should be able to build the project by executing make from your jshop2 root folder.
Related
I am trying to set up react-native (for Android) on my macOs but the app is failing to build so I am retrying it by following this link:
https://reactnative.dev/docs/environment-setup
In one of the steps, we have to add something to our $HOME/.bash_profile. I open it using vi .bash_profile and then paste the commands. Next, I am asked to 'Verify that ANDROID_HOME has been added to your path by running echo $PATH.'
When I run echo $PATH., I get this:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users//Library/Android/sdk/emulator:/Users//Library/Android/sdk/tools:/Users//Library/Android/sdk/tools/bin:/Users//Library/Android/sdk/platform-tools
I don't see the word ANDROID_HOME anywhere. Is there a problem here? Maybe with the path? Or is it being correctly verified?
I am running this in the root directory.
EDIT:
I managed to successfully setup everything and run the default AwesomeProject as well (from the root directory). However, when I try to run another project, it does not work. I see this:
SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting the sdk.dir path in your project's local properties file at '/Users/mycompany/insta/app/android/local.properties
What's the problem? Which steps from the setup should I repeat inside this particular folder? Should I make another bash profile? I don't get what path to add in the local.properties
You can find all the environment variable documentation here: https://developer.android.com/studio/command-line/variables
According to the dev website:
If ANDROID_HOME is defined and contains a valid SDK installation, its value is used instead of the value in ANDROID_SDK_ROOT.
If ANDROID_HOME is not defined, the value in ANDROID_SDK_ROOT is used.
If ANDROID_HOME is defined but does not exist or does not contain a valid SDK
installation, the value in ANDROID_SDK_ROOT is used instead.
Try echo $ANDROID_HOME. If that returns nothing try echo $ANDROID_SDK_ROOT. One of them should return your SDK directory. If not export one of them in your bash_profile as a env variable.
Easiest solution is to do a quick install of Android Studio and selecting the option to install SDK tools. This easily sets up your environment for android. All you need to do is add the SDK tools directory to your path once the install completes.
AVD images are pedantic if you change any directories and throw SDK_ROOT errors if you change things. Most problem free solution is to either download and run the installer or download the SDK tools, run the install and specify the path directory.
Your PATH variable is being correctly modified.
Echo your ANDROID_HOME variable to see what it is. It should be /Users//Library/Android/sdk/. When you use this variable in PATH, it's automatically being expanded when you echo it. You won't see "ANDROID_HOME" in the PATH.
create local.properties file inside android folder and paste sdk.dir={ANDROID_SDK_PATH}, then restart react-native server.
This problem has to do with two things:
local.properties file
ANDROID_HOME (SDK path)
Firstly,
For the local.properties, first make sure that the file is there in your project folder/android. If the file is there open it and make sure that the sdk.dir is pointing to your android SDK directory.
and if the file is not there create it and paste this:
sdk.dir = /Users/USERNAME/Library/Android/sdk
Replace USERNAME with your username
Secondly,
make sure that the ANDROID_HOME is there in the system variables and is also pointing to your android SDK directory.
or create new system variable named ANDROID_HOME and set the value your android SDK directory path if it's not there
Been trying to build Apache Cassandra using Ant. The build is successful, but the Cassandra server won't start using bin\cassandra because of the error: Error opening zip file or JAR manifest missing : D:\cassandra\lib\jamm-0.3.2.
Here is the environment setup:
JDK 8 bin directory added to PATH
JAVA_HOME is set to the JDK 8 directory
CASSANDRA_HOME is set to D:\cassandra, where I cloned the repo
D:\cassandra\lib\jamm-0.3.2.jar exists
Just in case I tried recloning the repo in another directory, rebuilding, but same error.
Checking the output when building, I noticed warnings like this one, I don't know if it is relevant.
[artifact:dependencies] [WARNING] POM for 'org.perfkit.sjk.parsers:sjk-jfr5:pom:
0.5:compile' is invalid.
[artifact:dependencies]
[artifact:dependencies] Its dependencies (if any) will NOT be available to the c
urrent build.
Any idea of what else I could test? Thank you.
I've seen this issue, too, when running Cassandra from my build directory.
What you'll want to do is to "deploy" your build (target) to a different directory, and set your CASSANDRA_HOME to that. Essentially, you'll want to emulate the how the "delivered" directory structure looks, ensuring that subdirs like bin/, conf/ and lib/ are at the same directory level.
Try that and see if it helps.
I forgot to mention that I set the environment variables PATH, CASSANDRA_HOME and JAVA_HOME using the set command.
By going to the system parameters and changing the user variables, it worked. I changed those three at the same time so I am not sure which one was blocking.
I am using centos and I have 4 to 5 jar files which I want to add permanently in classpath, So that I can run my program from anywhere. I tried this-
export CLASSPATH="/path/to/file:/path/to/file2"
Above command worked perfectly but I think it was not adding files permanently. When I opened new tab and tried to compile my program then I was getting same error i.e jar files were missing.
Now, Please help me to add these jar files permanently to classpath.
You could add that export statement to the end of your bash init file ~/.bashrc, therefore it will in effect all the time.
By the way, a better setting of CLASSPATH would be
export CLASSPATH="/path/to/file":"/path/to/file2":"${CLASSPATH}"
this will also preserve the initial value of that environment variable.
Add your path to /etc/profile and reboot to take effect
export CLASSPATH="/path/to/file:/path/to/file2"
this will sound silly but i am executing my code from command prompt and have to use a jar in my class.
I have placed my jar in lib folder of JDK..
but i am still getting error of file not found
any explanation??
EDITED : guys tried all but still not working
EDIT 2 :i am trying to work as was told by this link i am using js-1.6R5.jar
Edit 3 : i undestand all the things you ppl have told but nothing working for me.. pls give me a link to upload my example that i can share with you all.
Edit 4 : i am fed up by setting classpaths but its not working... i have SDK installed in my system, do i need an extra JDK to run my programs from command prompt??
You need to add the jar to the class path by doing the following...
java -classpath D:\myprogram;D:\myprogram\lib\supportLib.jar org.mypackage.HelloWorld
Please see Wikipedia - Classpath_(Java)
You can place it anywhere, as long is you include it in your classpath. See Setting the Class Path for how to include jars in the classpath.
Have in mind that adding something in the JDK lib is almost never a good idea.
You can make a lib folder in your application's directory and put jar files there, then make your application find them by adding lib to your application's classpath.
And, don't put your jar files in JDK's lib folder. It's not good practise.
You need to let Java know that you want to include the jar in your classpath (the list of folders and jars it checks for classes). One way to do this is with the -cp command line argument, something like
java -cp ".;pathToMyJar\myJar.jar" MyClass
Another is to edit the CLASSPATH environment variable in your OS to include your jar.
A simple solution will be to place the jar fiel inside the windows folder if you are doing it in a Windows machine.
Unfortunately your question contains a lot of question signs and few information.
If you are using java.io.File to open jar as a regular file this jar should not be in lib directory. You just have to provide correct path in file system.
If however you are just trying to use jar as a part of your application it should be in classpath. Use either command line java -cp myjar.jar MyMainClassor put full path to this jar to global environment variableCLASSPATH`.
I'm trying to recompile a project I've been working on and I keep getting an error message when trying to load a property file:
The system cannot find the path specified.
I guess this has to do with the classpath. But I've added the path to the file in Properties-> Java build path-> Libraries (external class).
I also checked the .classpath file generated by eclipse, and the path is really there!
Why isn't Eclipse looking at the right path?
There 2 different classpaths, build classpath and runtime classpath. The one you are setting is the build classpath.
Check your runtime classpath by going to Run -> Run Configurations and select your application configuration. Check the classpath setting there.
There is another workaround for this also. Eclipse by default will include your output folder (usually named bin) in your classpath. Typically anything that are not compilable in src folder will be copied to bin as is. I assumed your property file is not located in src folder. What you can do is to open your project property and add the folder where your property is located into Java Buld Path -> Source (tab). This way eclipse will copy the content of that folder into bin and will be in the classpath.
There are several ways to read a property file:
Have it in the current working directory (the one cd'ed to). You can do this in the Eclipse launch configuration. (Run -> Run...)
Include it in your application, by having it in a source folder. You then need to read it in through a class loader to be able to get it always (when jarred up, through Java Web Start, etc).
Double check if the property file or its directory is in the excluded list of the project Source. If it is remove the exclusion filter and try recompiling.