Comments (6)
I have no clue, what's causing the lack of -jshell
, but "Could not find or load main class" is a problem with your application, not Java*. It means, that the file you're trying to run does not have a main()
method. The only solution I can see here is:
- Java does not have access to your file (for some reason)
- Application is broken (probably)
- You're running a
.jar
file without-jar
parameter (make sure it's the last one)
*However, if you're still not sure, you can always try running a different app, that you're sure, it works. Minecraft server is running fine (although it melts your phone). I checked.
from termux-java.
Well, I will give answer to your points in the same way
- I think this is the main reason behind this. I have seen some videos about this same issue coming in windows, they have solved it by making a new environment variable
- It is impossible (I hope) because it's termux
- There is nothing related to .jar/-jar because it's one of the simplest program I have written using an editor with .java extension and I just want to compile/run it on termux
May be it is due to absence of -jshell or may be there's something wrong in this package. While compiling the program using javac (.java) it compiles fine and also I had seen that .class file is also generated but this error occurs when I try to run it using java command. I have checked the path.
from termux-java.
Well... It's probably exactly what you just did and I'm asking this question for no reason, but: Are you sure that (since you're running a .class
file) you're using java Program
not java Program.class
? I just checked and java Program.class
returns Error: Could not find or load main class Program.class
, while the other one works. Also, you must be in the same folder.
from termux-java.
Yeah, I have used java_program and not java_program.class with java command because I know that latter will create this error. But the unfortunate is the same error with java java_program command
from termux-java.
:-/ Well, I have no clue then.
But could you please try running a .jar
file, just to make sure it's really not working? Maybe there's an issue with .class
files on your phone. For... some reason 🤔?
from termux-java.
According to the error message ("Could not find or load main class"), there are two categories of problems:
- The Main class could not be found
- The Main class could not be loaded
The Main class could not be found when there is a typo or wrong syntax in the fully qualified class name or it does not exist in the provided classpath.
The Main class could not be loaded when the class cannot be initiated. Typically the main class extends another class and that class does not exist in the provided classpath.
For example:
public class YourMain extends org.apache.camel.spring.Main
If camel-spring is not included, this error will be reported.
Other reasons to occur this error is :
- File Extension
- Wrong package
- Invalid Classpath
- Wrong Class Name
from termux-java.
Related Issues (20)
- Error: JNA temporary directory '/tmp' does not exist
- Networking failure HOT 3
- It didn't work. HOT 1
- What does that mean ? HOT 2
- Android 11 termux java fixer HOT 5
- Error while installing HOT 2
- Bad system call HOT 1
- line 45: cd: /share: Not a directory
- Java
- "Bad system call" error HOT 1
- [1] 23205 invalid system call java -version HOT 2
- Not working HOT 1
- 6177 Bad system call
- Gradle not working
- libpthread.so.0: cannot open shared object file: No such file or directory HOT 4
- PaperMC Server not working! HOT 1
- Confused HOT 1
- ./gradlew build doesnt work HOT 1
- Segmentation fault
- --------‐-‐-----pkg install wget && wget https://raw.githubusercontent.com/MasterDevX/java/master/installjava && bash installjava--------------------- HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from termux-java.