The primary, direct issue right now is this: I can't open Eclipse anymore, and I can't seem to open Java, or execute Java codes-- all apparently in relation to an "Access is denied." error.
The first sign of this problem was when I tried to execute Hello World through Command Prompt. Following the instructions exactly in a video, when I attempted the apparent executing command code:
C:\Programs>java Helloworld
...I would get the message "Access is denied". After much troubleshooting, I found that if I gave the exact folder chain the program was in, I could get Hello World! to work. This looked like:
C:\Users\Spiralgo\Desktop\Coding>java HelloWorld
Ok, fair enough. But then it happened again in Eclipse. Following elsewhere in the video, there is the execution of the HelloWorld program directly in the Eclipse IDE. But when I followed the instructions exactly, I would get the following error:
CreateProcess error=5, Access is denied.
The file location shouldn't be a problem here... Since the code was getting written directly in Eclipse. I asked for help here in an earlier thread and was recommended to (1) try rewriting the code in Eclipse and then (2) to delete and reinstall Java. Rewriting the code led to the same error, so I tried deleting Java, and then reinstalling it. Some problems associated with this:
I can't tell if Java was properly deleted or not. There are so many Java files that I'm not sure if I deleted the right one, and there doesn't seem to be a convenient way to catch all of them in one deletion. I noticed there is a Java uninstaller program, but I can't tell if using that is properly deleting Java, or if I need to go a step further and erase everything before re-downloading.
When using the Java Uninstaller, the program warns me that I already have an up-to-date version of Java, and that the program is meant to be used to get rid of out-of-date versions of Java.
I tried downloading Java online after I thought I had deleted it. I simply went for what seemed to be the easiest download possible, on this site: (https://java.com/en/) and going through the big red button. This is different from the more "complicated" method described in the original download instructions I used, but I figured if I was having issues related to beginners, it would be fine to try a simpler route. However, this method seemed to download a different series of programs onto my computer: a Java folder containing the programs "About Java", "Check for Updates", "Configure Java", "Get Help", and "Visit java.com".
And guess what... Trying to open "Configure Java" leads to an "Access is denied" error! Here is the full message:
Java Control Panel
Access is denied.
"C:\Program Files (x86)\Java\jre1.8.0_261\bin\javaw.exe" -Xbootclasspath/a:"C:\Program Files (x86)\Java\jre1.8.0_261\bin..\lib\deploy.jar" -Djava.locale.providers=HOST,JRE,SPI -Djdk.disableLastUsageTracking -Dsun.java2d.dpiaware=true -Duser.home="C:\Users\Spiralgo" com.sun.deploy.panel.ControlPanel
And now Eclipse won't open. When clicking on it I get a very long message that begins with: "JVM terminated. Exit code=2".
So at this point I can't even tell if I have Java or not right now. I also don't know if all of this is related to the consistent "Access is denied" message related to Java, and whether that's related to using different Java versions, or if my computer itself has some inappropriate setting that restricts access to things.
You can read more about how this problem evolved from the previous thread: Access Denied running "Hello World" program through Eclipse
Related
So recently I was bombarded with the below error.
I have a very bad understanding of Java and how the internal memory location and file compiling work. So, when I ran my program(every program gave me the error so I guess it doesn't matter which program I ran and for that matter, I didn't include it here), it started giving me this error. I looked if there were any errors with my classpath and working directory, but still, after applying those too it didn't help much, and I still got the same errors.
The programs ran from the terminal using commands but from the normal "Run" function, it gave me this error.
I just restored the default setting of the IDE and it now works.
The difference I found was that after restoring the default settings, the project location was the default folder- IdeaProjects- whereas when I encountered the error I used to set my own location for the projects. Is it due to this? I had the same kind of problem in eclipse when I set the location of the project outside of the eclipse workspace.
Is the location of the project simply the reason I got the below error and if so why? I just don't understand how the internal mechanism of the whole programming thing works. About the directory, memory allocation, etc. Can anyone provide some decent materials after which I can be at a stage where I can separate what is the error and why is it causing or why the program doesn't run?
Full error:
/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/java -javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=57983:/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/(myname)/Desktop/Folders/College/2nd sem/CS 2/Labs:projects/Lab3/Lab3dot34.0/out/production/Lab3dot34.0:/Users/(myname)/Desktop/Folders/College/2nd sem/CS 2/Labs:projects/Lab3/Lab3dot34.0 Main
Error: Could not find or load main class Main
Caused by: java.lang.ClassNotFoundException: Main
Initially, I tried to view the working directories and add/change the classpath from the project structures like every suggestion found on the internet but still, the error existed.
So in the past days i've decompiled minecraft 1.12.2 using mcp to make an "own" client. I ran it from eclipse and all was working just fine. But once i exported it, added the needed JSON file and started it from the minecraft launcher, it resulted the following error:
Exception in thread "Client thread" java.lang.NoSuchMethodError: org.apache.logging.log4j.Logger.info(Ljava/lang/String;Ljava/lang/Object;)V
at net.minecraft.client.Minecraft.<init>(Minecraft.java:420)
at net.minecraft.client.main.Main.main(Main.java:115)
In my opinion that'a a bit strange, because when I ran it from eclipse that error did NOT occur.
I was thinking about adding the logger in the specific JSON file for the version but I do not know how to do it. I took the JSON file from a video where I expected my problem to be solved, made some changes, but it didn't. I also put the folder containing the logger-jar (org.apache....) in the client jar, but still no success.
Also i just decompiled 1.12.2 and recompiled it right away to see if i had messed up my code some how.
I hope someone can help.
This means at runtime you have a class that is different than what you had at compile time. You should try unzipping the jar and searching for the class file. It sounds like you need to potentially remove it and replace it with your own version.
Thanks to all who viewed an wanted to help!
Now I found an other way to use it. I wanted to export it to test
it on my server. But instead I used my account credentials to log in directly from eclipse.
:)
Hello!
The goal I have is pretty simple: I want to create an executable .jar file which should be able to bring up a form (made using swing) and write the put-in information into a well structurized plain text file. Due to portability/mobility reasons I will have to run this on an Android phone.
Since Android unfortunately doesn't have native Java support and I am unable to code a real Android application myself, I tried to use a Java emulator. Unfortunately, it appears that a working Java Emulator is hard to find to begin with. JBED instantly crashes on my Medion X701. Netmite's Website, which also seems to offer a .jar to .apk converter, appears to be down. JBlend seems to have installed properly, but I do not know how to work with the program now that it presents me nothing but an empty screen with the caption "0 Java ME Application(s)". On the web, I could not find a proper manual. PhoneME's official website was Java.net, which is no longer active. But during my research, I could find an older Version of PhoneME which seems to be running well.
As a test, I created a simple jar file that shows a maximized JFrame. Unfortunately, it isn't able to run my simple executable Jar file on my phone. The main reason for that should be the aforementioned error, which implies that the interpreter there is probably Java version 1.7, since PhoneME's last release was in 2015. There are more error messages referring to an "unknown source", which I believe originate from the first error. I tried to recompile my jar file using Eclipse, by setting the Compiler compliance level to 1.7 and choosing the jre 1.7 before exporting my project. Unfortunately, this didn't change the error messages I got on PhoneME!
As my last attempt, I created a Startup.class file which does the very same thing as my jar file.
import javax.swing.*;
public class Startup {
public static void main(String[] args) {
JFrame fishForm = new JFrame("Questionnaire");
fishForm.setExtendedState(JFrame.MAXIMIZED_BOTH);
fishForm.setVisible(true);
}
}
I compiled it using the command prompt in order to make sure that it is indeed using java 1.7 as the target. This .class file, which ran fine on my computer, leads me into a different error: "Main class name missing.", followed by multiple lines of usage explaination. The command line PhoneME presents doesn't seem to allow me to post command operations myself, as pressing Enter on the virtual keyboard does nothing.
My Questions
Is it even possible to run a Java application on Android which relies on the GUI libraries of Swing, or am I wasting my time?
Is there a different, up-to-date Java emulator for Android which I could use? Or is there a working jar2apk converter somewhere out there?
If not, then there's probably a reason why Java emulators ceased to exist. Is there a much simpler solution for my initial problem which I am missing?
I'll await your ideas eagerly!
So while attempting to install JDK via new task on task manager, it gives me the following error message:
Unable to install Java
There are errors in the following switches: "(1).exe";
Check that the commands are valid and try again.
I searched for the problem using "There are errors in the following switches" and turned up only one result which didn't help (surprising, considering the internet we live in today). Any and all diagnostic help is much appreciated, I've run out of things to try.
Note: Only this .exe is giving me issues, all other .exe s run fine.
(The original poster has probably moved on. This is for people who encounter the same problem and find this Q&A via a Google search.)
The Question does not include enough information to diagnose the problem. Based on the little that has been provided, I would consider the following:
Maybe the ".exe" came from a suspect source. Download it again from the official Oracle Java download site. (Don't trust 3rd-party download sites. They may be serving up an installer that is actually a trojan horse, or loaded up with bloatware...)
The executable name "(1).exe" is most unusual. Maybe it is the name that is causing the installer to get confused. If the name got changed when you downloaded the file, try changing it back to whatever it should be ... or downloading it again.
You didn't say clearly how you tried to run the installer. Maybe you actually did invoke it the wrong way; e.g. with /(1).exe as a "switch".
Should I attempt a manual installation? Placing files where they need to go.
No. Bad idea. The installer should work if you have a genuine one and you run it the right way.
I'm trying out the sample apps that come bundled with the play download and they appear not to be working, but the exception I'm getting isn't clear about what's going on.
I've previously been able to create new applications in Play ok, so this seems a bit odd.
I switched to the samples folder and simply trying running "play":
$ cd ~/play-2.1.1/samples/java/helloworld/
$ play
Which should bring up the play console.
Instead I get this output + exception:
[info] Loading project definition from /home/john/play-2.1.1/samples/java/helloworld/project
exception when typing play.Project.javaCore
class file needed by PlayReloader is missing.
reference type SBTLink of package play.core refers to nonexisting symbol. in file /home/john/play-2.1.1/samples/java/helloworld/project/Build.scala
scala.tools.nsc.symtab.Types$TypeError: class file needed by PlayReloader is missing.
reference type SBTLink of package play.core refers to nonexisting symbol.
at scala.tools.nsc.symtab.classfile.UnPickler$CompileScan.toTypeError(UnPickler.scala:66)
at scala.tools.nsc.symtab.classfile.UnPickler$CompileScan$LazyTypeRef.complete(UnPickler.scala:79)
at scala.tools.nsc.symtab.classfile.UnPickler$CompileScan$LazyTypeRef.load(UnPickler.scala:81)
at scala.tools.nsc.symtab.Symbols$Symbol.typeParams(Symbols.scala:913)
... <rest omitted for brevity> ...
[error] (compile:compile) java.lang.Error
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
It looks like it's not resolving a dependency or something as it's complaining that it's can't find a specific class (SBTLink?)? But really not so sure what's going on here.
Anyone got any ideas on what I'm doing wrong?
UPDATE: actually this appears to be happening for other play projects - so it's not specific to the sample apps.
I've just been able to make a new app ok (using "play new"), but when I switch into it's folder and run "play" I get the same exception as above.
Ok so in the end I had to delete the repository cache - I'm guessing it'd got corrupted somehow. Which would explain why it was complaining about not being able to find some class files.
Another possibility about why it stopped working may be due updates to java itself. There had been at least one update to java (to 1.7.0_25 on ubuntu) since I last tried running play, so there may have been some issue there (perhaps minor binary class file change?).
My play folder is in my home directory, so I did the following:
$ cd ~/play-2.1.1/
$ rm -r repository/cache/
Then tried running play again inside one of the sample app folders. It took a while (presumably as it was rebuilding the cache) and then worked.