A UNIX user named Bob wants to replace his chess program with a new one, but he is not sure where the old one is installed. Bob is currently able to run a Java chess program starting from his home directory /home/bob using the command: java -classpath /test:/home/bob/downloads/.jar games.Chess Bob's CLASSPATH is set (at login time) to: /usr/lib:/home/bob/classes:/opt/java/lib:/opt/java/lib/.jar What is a possible location for the Chess.class file?
/test/Chess.class
/home/bob/Chess.class
/test/games/Chess.class
/usr/lib/games/Chess.class
/home/bob/games/Chess.class
inside jarfile /opt/java/lib/Games.jar (with a correct manifest)
inside jarfile /home/bob/downloads/Games.jar (with a correct manifest)
please answer this question
Only this is the answer:
(3) /test/games/Chess.class
Because when you specify -classpath you override CLASSPATH from the OS for this execution. And they say that "Bob is currently able to run a Java chess program " so the new version is not in the CLASSPATH but in the path specified by Bob. So only (3) is the answer.
Classpath loading always seemed tricky for me, I hope that my answer is correct.
/test/Chess.class - no, Chess class must be inside games package
/home/bob/Chess.class - no, same as above
/test/games/Chess.class - yes
/usr/lib/games/Chess.class - yes
/home/bob/games/Chess.class - no, /home/bob is not added to classpath
inside jarfile /opt/java/lib/Games.jar (with a correct manifest) - no, /opt/java/lib/.jar - cp can not be defined this way; correct path: /opt/java/lib/*
inside jarfile /home/bob/downloads/Games.jar (with a correct manifest) - no, same as above
Related
I'm trying to build my OwnCloud client. I'm using "Generic Build Instructions" from this link - https://doc.owncloud.org/desktop/2.5/building.html.
I'm stuck at 3 step with an error:
Could NOT find Qt5Keychain (missing: QTKEYCHAIN_LIBRARY)
I downloaded Qtkeychain and compiled it using this link - https://github.com/frankosterfeld/qtkeychain/wiki.
Everything is in my C disk. PATHS are set correctly. Can someone tell me what am missing here.
Adding PATH photo:
Adding a photo to be clear what am talking about:
How did you compile qtkeychain?
With the environment variable %QTDIR% set correctly, e.g. C:\Qt\Qt5.6.0\5.6\msvc2015, you should be able to compile qtkeychain
cmake -G "MinGW Makefiles" .
mingw32-make
and get a 32bit file named "libqt5keychain.dll.a".
You can then add the directory containing this file to your Windows path environment variable. This should work (it does for Nextcloud, at least).
My processing units have runtime dependencies and if I put them into $GigaSpaces_root/lib/required then my PUs deploys fine.
But I'd like to keep GS root distr unattached (even owned by root) and put these libs into some other custom dir. But I can't find a way to configure GS to look for dependencies in my custom dir. PRE_CLASSPATH, CLASSPATH, POST_CLASSPATH don't help. Other useful variables are overwritten by setenv.sh on GS initialization. What I'v done:
strings -a /proc/{GSC_PID}/environ | grep tmp
POST_CLASSPATH=/tmp/lib
PRE_CLASSPATH=/tmp/lib
CLASSPATH=/tmp/lib
The question is how to configure GS to look for libraries in custom directory?
Solution is here: http://docs.gigaspaces.com/sbp/moving-into-production-checklist.html#runtime-files-location
export GSC_JAVA_OPTIONS="$GSC_JAVA_OPTIONS -Dcom.gs.pu-common=YOUR_DIR_FOR_LIB"
Hi everyone !
I'm facing a problem since I'm migrating my app from Java6 to Java8 for MacOS (and other OS but with windows/linux there is NO problem !).
When I was using Java6 I used MacOS APP "App Bundler" to do the package.
This tools reference to a plist file that contains all package information and provide the ability to add an option "WorkingDirectory" and a variable $APP_PACKAGE to set the working directory of the package inside the package like that:
<key>WorkingDirectory</key>
<string>$$APP_PACKAGE/Contents/Resources/Java</string>
Unfortunately, this option "WorkingDirectory" does not exist with the bundler appbundler that provides support for Java 6 superior versions.
So I googled a lot and found this issue; Apple Issue
So I added <option value="-Duser.dir=$APP_ROOT/Contents/Resources"/> to my plist file via ant task like that:
<key>JVMOptions</key>
<array>
<string>-Xdock:icon=Contents/Resources/${bundle.icon}</string>
<string>-Duser.dir=$APP_ROOT/Contents/Resources</string>
</array>
And I tied also this:
<option value="-Duser.dir=$APP_ROOT/Contents/Java" />
<argument value="-Duser.dir=$APP_ROOT/Contents/Java"/>
Without success :-(
And I added a big "verrue" on early start of my Java application like that (as said here):
String os = System.getProperty("os.name").toLowerCase();
System.out.println("os:" +os);
if (os.indexOf( "mac" ) >= 0){
try {
System.setProperty("user.dir", new File(".").getCanonicalPath());
System.out.println("user dir:" +System.getProperty("user.dir"));
System.out.println(new File(".").toURI());
System.out.println("Working directory: "+(new File(".").getCanonicalPath()));
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
}
But nothing works; when I was creating file from the previous Java application they were created into the application working dir like /Applications/MyApp.app/Content/Java, but know when I create a file/folder it is created under /Users/MyUserName
I also follow this PATCH (I post a question) and compile a new jar but the <string>-Duser.dir=$APP_PATH/Contents/Java</string> does not do the job, the env variable is not user system created and used!
It's driving me silly... Any idea ? Regards !!
[EDIT1] As a workaround and because it is also simple but too bad I just changed all my relative paths (some at least !) like that:
String path = new File(".").getCanonicalPath();
File myFile = new File(path+File.separator+"MyFile");
It acts similar to set the working directory variable but I have to change a lot of my code rather than use a single option (and on Linux and Windows I do not have this type of problem) :-( Anyway thanks to Trejkaz to have answer on my issue... and sorry for my misspellings and my poor English.
Another time, Regards !!
[EDIT2] So I edited all my relative paths but I had a second problem with the appbundle: Every ProcessBuilder commands fails when launched by the bundle but succeed when clicking on the jar so I used "desktop" intead like this:
DesktopApi desktopApi = new DesktopApi();
desktopApi.open("path-to-my-jar"+File.Separator+"MyJar.jar");
I use the class 'DesktopApi' found here coded by MightyPork (Regards !!) as sometimes desktop command provided by JRE fails...
So I'm done with this fu***** packaging now !!! Regards !!
When configuring a second Entrypoint and second module in my gwt application I receive the following warning:
[WARN] Unknown module requested 'iovadmin'; all active GWT modules must be specified in the command line arguments
and the following error:
[ERROR] Unable to find 'iovadmin.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
Can someone explain me the necessary steps to correctly configure a second entrypoint in my application?
Thanks in advance,
Tom
If you want to have a second EntryPoint, make sure that you have all the needed files. That is:
- In your project src/com/.../ root folder you must have your SecondEntry.gwt.xml file, with the proper tag
- In your war/ folder you need to have the proper SecondEntry.html file
- In your war/WEB-INF/web.xml you need to have the proper servlet-mapping pointing to your second servlet.
If you have all these files, you'll need to post them to see where's the problem.
I'm trying to run a GWT unit test in a sample app. I ran
cmd /c /java/gwt-windows-1.6.4/webAppCreator.cmd -out gwttasks com.gwttasks.GwtTasks
Copied in junit-4.5.jar into a lib directory, and added that to the classpath.
Ran:
cmd /c /java/gwt-windows-1.6.4/junitCreator.cmd -junit lib/junit-4.5.jar -module com.gwttasks.GwtTasks -eclipse GwtTasks com.gwt
tasks.unit.GwtJunit
When I try to run any of the generated cmd file (such as GwtJunit-hosted.cmd) or any of the launch files, I get the following error. All the web pages I've seen say to add the test source to the classpath, but it's already there, so that's not the problem. Anyone else seen this?
com.google.gwt.junit.JUnitFatalLaunchException: The test class 'com.gwttasks.unit.GwtJunit' was not found in module 'com.gwttasks.GwtTasks'; no compilation unit for that type was seen
at com.google.gwt.junit.JUnitShell.checkTestClassInCurrentModule(JUnitShell.java:390)
at com.google.gwt.junit.JUnitShell.runTestImpl(JUnitShell.java:626)
...
The answer could be found here :
http://raibledesigns.com/rd/entry/testing_gwt_applications
In netbeans I added the src/java and test to the class path and debugging worked!!!!!
THANKS
I just want to add that I had the same problem, because I did the (very silly) mistake to not put the GWTTestCase class into the "client" directory, but into another one. No wonder it wasn't found ;)