UnavailableServiceException on lookup for "javax.jnlp.BasicService" - java

UnavailableServiceException is being thrown on look-up for javax.jnlp.BasicService.
Below is the code snippet:
BasicService basicServiceHandle =
(BasicService)ServiceManager.lookup("javax.jnlp.BasicService");
I am just trying an example of jnlp API - BasicService # http://pscode.org/jws/api.html#bs as a Java Application.
Any suggestions as to what could be the reason for the same... or anything that could be worth checking?
Update
I am not sure how I should be trying it from eclipse.

..not sure how I should be trying it from eclipse
File|New|Java Project
Project name: BasicService|Finish
File|Import
General|Archive File|Next
From archive file: basicservice.zip (Into folder: BasicService)|Finish
In the 'Package Explorer', navigate to: BasiceService/basicservice/build.xml
Ctrl+F11 (Run)
Ant Build|OK
(Follow the prompts)
There may be better ways. That as shown is just what I figured out from having downloaded Eclipse and doing a bit of a crash/bang through the help.

Related

I'm having a trouble with starting Eclipse : Error : ... cannot be solved to a type

I really don't know what the problem is.
I followed several web postings about installing and settings of JDK/ JRE and also completed clearly on environment variables :Path & CLASS PATH
I'm sure about that since i checked the cmd and it worked well.
the same problem occured over and over again.
I corrected on Library tab
I add the Library list like this,
But, I still have the same problem. Did I make a severe mistake? what should I do about this problem?
still have JAVA problems
Please check the Java source directory configuration under Java Build Path, Source tab and Java Compiler version settings.
Did you recently update your Java version? If so, then you have to readjust your path so that it directs to the new updated version.

Compiling standalone selenium: Failed to load Main-Class manifest attribute from

I'm a total Java noob so please understand =) I need a quick advice on how to fix the issue.
I cloned the official selenium git repo, changed the code a bit (need to dump the page into some specified dirs), and tried to rebuilt it:
./go //java/server/src/org/openqa/selenium/remote/server:server:uber //java/client/src/org/openqa/selenium:client-combined:uber
It was successful but when I tried to execute it I got this:
$ java -jar build/java/server/src/org/openqa/selenium/remote/server/server-standalone.jar
Failed to load Main-Class manifest attribute from
build/java/server/src/org/openqa/selenium/remote/server/server-standalone.jar
Tried to check classpath, CLASS_PATH and CLASSPATH env variables (as a friend of mine suggested) - I simply don't have any.
At the same time, the pre-compiled standalone server from the official downloads works out of the box.
The official docs didn't help. There's nothing about it there.
So - I need a quick advice how to compile it? Thanks.
P.S. JDK 8 (latest), Mac OS 10.7
P.P.S. That friend of mine tried to build it by himself and he was lucky - he got a new build/dist folder where the target big file was. But in my case, the build folder is created, but there's not 'dist' folder in it.
Finally found the answer: I should have built it like that:
./go clean release
it's really strange that all the docs state I need to use these long /bla/bla/:uber things to get a whole single 'uber' server.

Import EMX into Eclipse via command line

I hope my question will be clear enough as I am not used to Eclipse environment.
My goal is to create a project in Eclipse with an already existing EMX file. I gather that file from a Git repository.
And I would like to create a command line (or a script, or anything I can run automatically from remote) that imports that EMX file into Eclipse, so I can use another script (already created) to work with this EMX.
My problem is that I don't know how to create this script or command line.
I've tried solutions found here at StackOverflow, without success. Maybe I'm just bad :p
As I am beginner in Eclipse stuff, if someone has a link to a clear tutorial or working example, it would be very nice.
Note: I just have the EMX file (no .project or whatever). So I guess I need to create a project with this file, and not just import an existing project.
Thank you very much for your help :)
Laurent
I finally managed to do what I wanted by creating a plugin which imports projects from a given path into my current workspace.
Main part of the code is from: http://code.google.com/p/headlesseclipse/source/browse/branches/JUnit/com.ind.eclipse.headlesseclipse/src/com/ind/eclipse/headlessworkspace/HeadlessProjectImport.java?r=88
I did not find any way to do this outside the plugin. Grovvy solution was giving plenty of errors and without CDT, the first simple solution I looked for was not available.

Stuck at converting/implementing Qt (.ui) files to Qtjambi(.jui) files

Edit 01.02.2012:
FWIW: 4.7.0 linux packages are broken AFAIK, they
can be fixed or 4.6 packages used instead...
No need to use
custom Qt for Jambi – Smar 2 days ago
Thanks to SMAR, I was finally able to resolve this
issue by downloading the an older version of
qtjambi 4.6.3 ( http://qt-jambi.org/downloads/ ). The only problem was that the
designer did not know where to find my jvm which
I solved by adding these two entries to /etc/bash.bashrc:
# custom PATH exports
export JAVA_HOME=/usr/lib/jvm/java-6-sun
PATH=$PATH:$JAVA_HOME/bin
Then I just had to run (everything was in the qtjambi-folder):
designer.sh --> save it as .jui --> convert it with juic into a .java file --> and load it with netbeans :)
Hope this is somehow helpful to others too.
Thanks for the great and fast help!
Original post:
Good evening,
I am not completely sure if this topic is enough about programming but I am having some problems setting up Qtjambi. I have followed a lot of "howtos" and instructions so I am a little confused about what to do next. Qtjambi works as I have written a example program with netbeans. Although I have created some ui files that I want to implement which doesnt work.
I am trying to get this to run for like a week and I really need this because of my finals in 2 months. I try to give as much useful details as possible.
I am using LinuxMint (ubuntu derivate), downloaded qtjambi v 4.7.0
after trying out
bash qtjambi.sh
I got an error of mismatching versions
Cannot mix incompatible Qt library (version 0x40704) with this library (version 0x40700)
So I downloaded, compiled and installed
qt-everywhere-opensource-src-4.7.0 to /usr/local/Trolltech/Qt-4.7.0/
I know that I have to tell the system where to find all the binarys so I added to the /etc/bash.bashrc
#custom PATH exports
PATH=$PATH:/home/michi/Scripts
PATH=$PATH:/usr/local/Trolltech/Qt-4.7.0/bin/
export LD_LIBRARY_PATH=/usr/local/Trolltech/Qt-4.7.0/lib
export QT_PLUGIN_PATH=/usr/local/Trolltech/Qt-4.7.0/plugins
JAVA_DIR=/usr/lib/jvm/java-6-sun-1.6.0.26/
export JAMBI_PATH=/usr/local/lib/qtjambi-linux64-community-4.7.0/
I followed through the instructions of:
http://www.davidlauzon.net/2010/01/getting-started-with-qt-jambi-on-linux/
Which generally talks about getting jambi-designer to work.
http://jpnurmi.kapsi.fi/blog/2008/03/16/how-to-switch-qt-version-in-ubuntu/
How to manage multiple Qt versions.. These commands worked but had no effect
I finally gave up on trying to run the designer and tried to "convert" the .ui files to .jui files with the program juic which is located in the qtjambi/bin folder. But also here I get an error:
michi#BALMORA ~/Documents/unterlagen/pr_scw/Qt/Qtrainer/test $ which juic
/usr/local/bin/juic
michi#BALMORA ~/Documents/unterlagen/pr_scw/Qt/Qtrainer/test $ juic -cp .
juic: no .jui files found in CLASSPATH
michi#BALMORA ~/Documents/unterlagen/pr_scw/Qt/Qtrainer/test $ /usr/locallib/qtjambi-linux64-community-4.7.0/bin/juic -cp .
juic: no .jui files found in CLASSPATH
It would be great if you could help/guide or redirect me to "better" instructions.
Michael Kargl

How to get MigLayout to work with my project?

I'm trying to make a small GUI app and I want to use MigLayout with it.
As Java newbie I don't know how to get MigLayout to work with my code and I'm running out of ideas.
My project source code is in ~/git/project/src/qdb/
The qdb is my java package name. I downloaded miglayout-3.7-swing.jar and miglayout-3.7.jar and placed them to my project sources and tried to compile the code but I get errors pointing to "new MigLayout()" stating "cannot find symbol".
I was in src dir and used "javac qdb/*.java" to compile (* gets expanded).
I also tried to point classpath to my sources like: "javac -classpath /home/user/git/project/src/qdb/ qdb/*.java" but I still get the error.
Then I've also tried to put the jar files to ~/jars/ and use that as classpath but still the same error follows.
So, how to get MigLayout working?
Simply add the miglayout-3.7-swing.jar to your classpath:
javac -classpath /your/path/to/miglayout-3.7-swing.jar qdb/*.java
(as illustrating in this thread Installing Mig Layout)
If you can compile them (with the above line),
but can not execute the resulting program, you also need to add to the java classpath the library
java -classpath /your/path/to/miglayout-3.7-swing.jar:/your/project/compiledClass/dir qdb.yourMainClass
If you are going to put it into a .jar file, you'll need to specify the Class-Path in the manifest file:
Class-Path: /your/path/to/miglayout.jar
VonC's answer is right. I just want to add (since you are a Java newbie) that you should consider developing using an IDE. They'll save you hours of by-hand-compiling, and will help you integrate your code with libraries (such as MigLayout) more easily.
There are two free IDEs I really like:
IBM's Eclipse.
SUN's (soon to be IBM's) Netbeans.
Also consider this SO thread. And this one too.
Good luck.

Categories