By running the same command from the Eclipse and from the command line I get 2 different results:
With Eclipse everything works fine, however with the command line I get the following error message:
PosixThing.java:17: error: error while writing PosixThing: PosixThing.class (Permission denied)
This error message does not appear if I run "sudo javac PosixThing.java".
As it if was not strange enough, the same code with a different file located in the same directory (Desktop) does not give me any problem. (I am talking about mere txt files just to test the PosixFilePermissions function).
I checked the file permissions and everything is -rw -rw -rw As well as the others'. Do not know why it happens only with that specific file.
Running on Ubuntu 11.10 jdk 1.7.
Any suggestion to what it might be?
It sounds like a file / filesystem permissions problem of some kind:
Check the owner, group and permissions for the file, and all directories on the file pathname.
Check that you are running Eclipse and your command shell as the same effective user.
Check that you are not attempting to write to some kind of "funky" file system; e.g. a Windows file system mounted on Linux, or a FUSE file system of some kind.
If you've got SELinux enabled, check that's not causing the problem. (That's unlikely.)
It is also possible that you are running different releases / versions of Java in the two contexts, or even that Eclipse's file system cache is out of sync. (It is not clear to me what contexts the code is actually running in.)
Related
We're experiencing a strange issue - has anybody seen anything similar?
We have a Java/JavaFX desktop application that has been running successfully on a Windows platform (Server 2012) for almost a year.
Recently we moved the application to a different Windows platform (Server 2019, virtual machine).
The app is installed on a shared drive and is started several times a day. It initially runs successfully but at some point in the day will no longer start.
The command line is:
java -p WolfToolkit.jar;WolfToolkit_mods -m com.mycompany.wolftoolkit/com.mycompany.start.StartGUI
WolfToolkit_mods is a folder containing jars for the required modules. When the start-up error occurs, Java.exe reports thatvarying required modules cannot be found. After a lot of diagnostic testing, it appears that Java.exe can no longer detect any of the jar files in the WolfToolkit_mods folder even though Windows Explorer shows the correct content.
If I copy folder WolfToolkit_mods to WolfToolkit_mods2 and change the command to
java -p WolfToolkit.jar;WolfToolkit_mods2...
then the app starts correctly.
If I re-copy just one of the jar files into WolfToolkit_mods and use the original command, then only that file is visible. If all files are re-copied then the app runs correctly.
So, the behaviour is as if Java suddenly views WolfToolkit_mods as being empty and only detects each jar file when it is copied back in. Meanwhile Windows sees no problems. I should also mention that on rare occasions Java.exe suddenly starts reporting that WolfToolkit.jar is "Module format not recognized". Again, re-copying the file resolves the issue.
Any ideas on what this could be or how to diagnose? Thanks.
Windows Server 2019 Standard v10.0
JVM: OpenJDK 64-bit Server v11.0.10+9
This looks to have been caused by the virus checker which was quarantining all .jar files as "suspicious". Presumably when java.exe was trying to read the files on the module path the virus checking software intervened and the effect was that java.exe couldn't locate module-info and so reported missing modules.
Thanks to those who took the time to respond.
I'm trying to install JDK 7 on a Windows 7 machine and constantly getting the error "A semi-colon found in selected path" no matter what path I select for the installation.
Tried with different updates of JDK and it didn't help either.
EDIT: Installation log shows the following error:
Thu May 05 06:34:19 2016
:: JDK installation failed. Return Code: 1603, ErrorCode: 0
This error message is displayed by the Microsoft Windows Installer engine and is a general error code that indicates a problem occurred during the installation.
Read on to learn how to sidestep this speed bump.
The following is a non-exhaustive list of known causes for this error:
Short file name creation is disabled on the target machine.
An Install Script custom action is prototyped incorrectly.
A file is locked and cannot be overwritten.
The Microsoft Windows Installer Service is not installed correctly.
The Windows Temp folders are full.
The setup was corrupted after installation and, therefore, fails with this error during un-installation.
An older version of Install Shield Developer is being used.
A general error occurred during the installation.
Print and File sharing is not installed or enabled when installing MSDE 2000.
How to Avoid this Error
The following solutions have resolved this error in the majority of cases:
Make sure short file name creation is enabled on the target machine. You can check to ensure that the target machine does not have short file name creation disabled by navigating to the following registry entry:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem
Make sure the value "NtfsDisable8dot3NameCreation" is equal to 0. This indicates that short file name creation is enabled. A value of 1 indicates that this functionality is disabled. You should change the value to 0.
After modifying this value, the target machine should be rebooted before attempting to launch the setup again.
Note: If the target machine should normally have short file name creation disabled, it can be disabled after the install completes by resetting "NtfsDisable8dot3NameCreation" to 1 and rebooting.
To ensure that the Windows Installer Service is properly installed and configured, it is recommended that users install the file InstmsiA.exe on Windows 95/98/Me or InstmsiW.exe on Win NT systems. These files are shipped with your InstallShield product and are located in the following location:
<Product Path>\Redist\Language Independent\i386
Empty all temporary folders. The specific temporary folders for a machine can be determined by accessing the DOS prompt and typing set. Note the values listed for TEMP and TMP, and delete all files in those locations.
Make sure no other applications, including utilities such as virus scanners, are running in the background. Close all running applications and utilities, and launch the installation again.
If this error occurs during un-installation, use the Microsoft Windows Installer CleanUp utility to uninstall the installation.
Once the installation has been successfully un-installed, you can then debug the project to determine what caused the original error.
Put your installer executable to C:\ and run it from there.
More info here: http://wills-tech-notes.blogspot.com/2015/12/cannot-install-java-semicolon-found-in.html
The Error which you are getting is normally it throws during java update installation, Not, the first time installation.
Please kindly follow the below steps to resolve your issues. Let's give a try.
Step 1:
Just want to ensure if you have already java installed on your machine partially.
Follow the below entries in command prompt:
java -version - If it throws error we are good.
echo %JAVA_HOME% and echo %JRE_HOME%
echo %PATH% - If you see the Java entries you may need to clear all this.
echo %CLASSPATH% - Here as well as said in above.
If no results from the Step 1, Please follow Step 2.
Step 2:
Check your C: drive for to verify there should not any Java installation folders. If yes, Please delete those.
Clear all your logs from your machine(If it contains any existing java related logs)
https://www.java.com/en/download/help/plugin_cache.xml
Step 3:
Actually, we do not require to install the Java, instead we can download the Zipped java file and locate into dedicated drive.
And then, make all your environment variables entries into this location. In, this case you are good i believe.
If you still face issues, do let me know?
Try this and maybe you'll get your job done
1 Close the installer when you see Java error 1603. (It has installed a
bunch of files, but exits prematurely.)
2 Open javacpl.exe from C:\Program Files (x86)\Java\jre1.8.0_XX\bin (or
for x64, C:\Program Files\Java\jre1.8.0_XX\bin) where XX is the update
number.
3 Uncheck "Enable Java content in the browser" on security tab and click
OK to close Java control panel
4 Retry installing Java. It usually succeeds for this time.
5 Open javacpl.exe again (see step #2)
6 Check Enable Java content in browser on security tab and click OK to
close Java control panel
7 If it still fails, try uninstalling windows update KB2918614, then
reboot and try these steps again.
Try following steps:
Run installer from c:/
Run jdk*...*.exe /log msi.log to see installation logs, please attach
them if it won't help you understand a cause of the problem
In the related JDK bug an issue with an environment was a cause of the problem.
uninstall KB3139923 helped in my case
I had the same problem with version 8 and the solution was to run the installer as Administrator (right click, then "Run as Administrator").
I have a program where I actively ping the contents of a directory using nio.WatchService.
Anytime a new file is added there, I process some custom logic. The path to the folder is read from a properties file and has the following format:
pathvar=C:\\files\\in\\ -->works on local
pathvar=\\\\serv123\\Share\\input\\ --> works on local
Both formats run fine on win 7 local (command line and through IDE). When
executed on a win 2008 R2 server, the program executes when path variable is local - no (mapped) network paths work.
pathvar=C:\\\\files\\in\\ -->works
pathvar=\\\\serv123\\Share\\input\\ --> does not work
pathvar=N:\\Share\\input\\ --> N: mapped to serv123 does not work
Code is same as listed here:Watching a Directory for Changes in Java
I don't get any exceptions either, but UNC paths are not working. Any help is appreciated.
Edit: The way I deducted the issue was path related(in absence of any exceptions), is by playing around with the paths.
I packaged it as a jar and run it on the command window as
java -jar myjar.jar
With pathvar=C:\files\in\, the programs runs and waits
With pathvar=\\server\files\in\, it quits immediately/
I've been googling for the better part of 4 hours and nothing I've tried has had any effect. This is your typical JAVA_HOME while configuring android studio on a machine for the first time problem it would appear. I've added literally everything to environment variables and path that I can think of. I've tried reinstalling JRE/JDK/Android Studio many many times. I've tried deleting .android and ..\Local\Temp items. I've tried running android.bat as admin. Nothing helps.
I can run find_java64.exe directly and it actually gives me the correct path, but in the batch file it says it can't find that file. The only thing I noticed is that it says "...Local\Android\sdk\tools\lib\\find_java64.exe" -s with two slashes instead of one after lib. That seems strange but not like it should cause it to not find it... and if I copy-paste the entire path with executable from the error line into command prompt (including the two slashes) it DOES show the JDK location correctly.
Why does the script not work if the line works in isolation? I can't do anything if this batch file isn't going to work.
Edit: I've been trying some more today. The core issue seems to be that when batch files are attempting to run other scripts/executables, windows always throws a is not recognized as an internal or external command, operable program or batch file." error. I've been tracing this through script after script from android.bat to find_java.bat. If I manually execute the command the batch file is trying to execute in command prompt, it works fine, but the batch file says it's wrong. Another suspicious thing seems to be that I cannot double click on ANY batch files in the computer. I can only open them as admin or from command prompt. Starting to think this is a very computer-specific problem.
If anybody else is seeing this, there's a real problem on your system when you can't launch a BAT file by double clicking it.
Something you could test on your machine is drop into a cmd shell then using the ftype and assoc builtins to check these are the defaults:
➜ ~\scoop\apps\android-sdk\current\tools\lib $ cmd
Microsoft Windows [Version 10.0.19041.572]
(c) 2020 Microsoft Corporation. All rights reserved.
C:\Users\cwalsh\scoop\apps\android-sdk\current\tools\lib>assoc .bat
.bat=batfile
C:\Users\cwalsh\scoop\apps\android-sdk\current\tools\lib>ftype batfile
batfile="%1" %*
If it's still broken you might need to dive into the registry and figure out why the .BAT file extension has a different program associated with it.
I have written a Java GUI app (using Netbeans 6.7) requiring Java 1.6. I successfully run it on my XP PC and also my Mac OSX (10.5.7).
My client is running Vista Business, and cannot run the application by double clicking the jar file. He can execute it from the command line: "javaw -jar ..." The error received is: "Cannot find the main class... Program will exit".
I've asked the client to do the following:
install the latest JRE
run JarFix
I've verified that:
JRE is installed in correct location
jar file association is correct
application works (as I have tested it on XP and Mac OSX, and the client can run it from the command line)
Any ideas on what else I can investigate? Note, Netbeans created the main jar file, and also a lib directory with a couple of other Jarfiles. I've unzipped the jarfile and examined the manifest file (which looks good). The correct main class is also within the app's jarfile.
Does the client need to be careful as to where the application is executed from in Vista?
Thanks very much.
Prembo
Does exactly the same JAR file work on other operating systems?
Is the manifest file (META-INF/MANIFEST.MF) in the JAR file correct? One catch to watch out for is that the manifest file MUST end with an empty line; if it doesn't, the last line in the manifest file will be ignored. So, for example, if the last line in your manifest file is something like this:
Main-Class: com.mypackage.MyProgram
and it is not followed by an empty line, then Java will ignore the line and it will not be able to find the main class of the program.
See Sun's Java Tutorial about deploying Java programs in JAR files for exact details about how to package your application in a JAR; it also contains the warning about the manifest file needing to end with an empty line.
Also, double-check if the right version of Java is used. Are you using the exact same version of Java as on Windows XP? Try:
java -version
to see which Java version is being used.
I'm running Vista Enterprise and have very little differences between it and other Windows versions (with regards to Java).
Here are some random ideas that may or may not work:
Have you tried: right clicking on the Jar -> Open with -> Java(TM) Platform SE Binary
Could it be permissions related? (probably not since it runs via the command line)
Have you tried it with UAC off? (UAC sandboxes java apps, and they can't write to certain locations like Program Files)
Did you make sure they have the same files as you in JAVA_HOME/lib/ext/
you could try setting environment variables:
JAVA_HOME=<your_java_home>
CLASSPATH=.
PATH=<your_java_home>\bin
Sometimes JDK needs to be installed separately,along with the net beans IDE. If you have jdk installed then you can try checking for classpath,path in the environmental variables.