Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import SwingX without IDE

This is my first post so please don't bite my head off!

I have found this: Java - How to import external packages?

and this: how to include libraries in java without using an IDE

but I'm still lost!

I have downloaded the file swingx-1.6.zip to my ~/Downloads folder (ubuntu) then unzipped it so I now have ~/Downloads/swingx-1.6 In this folder is swingx-1.6.jar which appears to have the class I want (JXPanel)

Then I ran this in a terminal: javac -classpath :~/Downloads/swingx-1.6/swingx-1.6.jar Panels.java were Panels.java is the class file which is (or will soon be) dependent on JXPanel.

I'm getting compile errors though!

Panels.java:6: package org.jdesktop.swingx does not exist
import org.jdesktop.swingx.JXPanel;
                      ^
1 error

My question is: Have I included the right files in the -classpath command? and Have I used the right import command?...

sorry for being such a noob, I really don't want to migrate to an IDE. I was just getting the hang of where I am now lol thanks in advance for your help.

like image 323
d.j.yotta Avatar asked Dec 14 '25 06:12

d.j.yotta


1 Answers

I think that you need to remove the ':' and also to use the full path, not ~/, because some software does not resolve it.

like image 138
Stefania Avatar answered Dec 15 '25 23:12

Stefania



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!