Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Having problem with Classpath, lead to more problem
Having problem with Classpath, lead to more problem [message #1830483] Mon, 27 July 2020 17:39 Go to next message
Mehdi K is currently offline Mehdi KFriend
Messages: 6
Registered: May 2020
Junior Member
It seems like the classpath is missing, trying to figure out how to solve this problem. I would appreciate if someone can help me. The initial problem I was having with something else, "Could not find or load main class" when I did something in the build path.



[Updated on: Mon, 27 July 2020 20:16]

Report message to a moderator

Re: Having problem with Classpath, lead to more problem [message #1830495 is a reply to message #1830483] Mon, 27 July 2020 19:40 Go to previous messageGo to next message
Mehdi K is currently offline Mehdi KFriend
Messages: 6
Registered: May 2020
Junior Member
index.php/fa/38667/0/

I have solved the issue. However, the problem now here is, I am trying to add my existing java files into a new package. I do not know how to import java files into new package. When I try to run it say

Exception in thread "main" java.lang.Error: Unresolved compilation problem:

at ss/ss.Add.main(Add.java:6)

What I tried to do was, copy my java files from the other package and paste into the new package in bin folder

[Updated on: Mon, 27 July 2020 20:13]

Report message to a moderator

Re: Having problem with Classpath, lead to more problem [message #1830511 is a reply to message #1830495] Tue, 28 July 2020 05:59 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 31624
Registered: July 2009
Senior Member
The package structure declared in your *.java files must mirror exactly the folder structure in the file system. Above you have the *.java file in the root "src" folder, but it declares a package name so must be in src/com/<...>. Note that it's bad style to name packages with upper case names.

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Having problem with Classpath, lead to more problem [message #1830530 is a reply to message #1830511] Tue, 28 July 2020 14:21 Go to previous messageGo to next message
Mehdi K is currently offline Mehdi KFriend
Messages: 6
Registered: May 2020
Junior Member
The structure wasn't like this, I made an mistake, I believe what I had done was change the build or refactor. How would I go about this?
Re: Having problem with Classpath, lead to more problem [message #1830552 is a reply to message #1830530] Wed, 29 July 2020 05:12 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 31624
Registered: July 2009
Senior Member
I'm really not sure how you got into this state. Certainly on the first page of the Java project wizard I would choose "Create separate folders for sources and class files". It's probably better to start from scratch. On the src folder, the context menu will have things like New -> Class and New -> Package which will create the correct structure.

Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Open file in Eclipse view programmatically
Next Topic:XML Perspective Target ID
Goto Forum:
  


Current Time: Sun Nov 29 08:27:30 GMT 2020

Powered by FUDForum. Page generated in 0.02904 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top