Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package to jar in eclipse [closed]

UPDATE: Don't worry. User Error. Would delete the question but cant with answers.

I am trying to use eclipse to create a jar of packages, not a runnable jar, which I can import into another project.

So far I have done this:

  1. Create a new project
  2. Create a package in that project (pkg.nme.with.dots)
  3. Create a class in that package
  4. Export -> Java -> Jar

The resultant .jar file has only one directory META-INF, and three files .project, .classpath, and MyClass.class.

If I try to import pkg.nme.with.dots.MyClass; I get a package not found error, despite adding the full path of the jar to my CLASSPATH.

I tried adding the jar as an external lib in eclipse but it is still not recognised.

Obviously I have exported it into a format that can't be imported. How do I export it correctly?

like image 665
jsj Avatar asked Feb 17 '23 02:02

jsj


1 Answers

@trideceth12 I just tested exporting a sample package in my eclipse. and my folder structure works fine. not sure why yours is not working properly. you should check all your export settings. here's what mine looks like, and it exports fine.enter image description here

like image 168
greenkode Avatar answered Feb 28 '23 14:02

greenkode