onyourmark
asked on
how to access a project in Eclipse from outside Eclipse
Hello. I have a project in Eclipse that seems to run. I have attached a screen shot. I also have a class file that I have been running from the command line. The class file is my main program. And since I am comfortable with the command line I want to continue to run it from there. The project in Eclipse (GoogleFinanceAndMail) has some functionality I want to use. I want to instantiate an instance of the what is in GoogleFinanceAndMail and use it. I am wondering how I access this project (GoogleFinanceAndMail)? Do I have to add something to the class path? And what if I want to move the whole thing to another computer, how do I do that? I am attaching the code where I instantiate GoogleFinanceAndMail. It begins on line 60 and goes to line 71.
Also, it requires a set of jar files that I downloaded from Google to access Google's API. Do I need to add each one into the CLASS PATH or is there an easier way? I am attaching a screenshot of the jar files as well.
screen-shot-of-google-finance-pr.PNG
sampleToAskAboutAccessingEclipse.java
libJar.PNG
Also, it requires a set of jar files that I downloaded from Google to access Google's API. Do I need to add each one into the CLASS PATH or is there an easier way? I am attaching a screenshot of the jar files as well.
screen-shot-of-google-finance-pr.PNG
sampleToAskAboutAccessingEclipse.java
libJar.PNG
Yes, you'll have to enumerate all your jar files in your classpath
classpath can be soecified either on command line as I showed or beforehand
set CLASSPATH=C:\folder\bin;c: \folder\li b\my.jar;. ..
classpath can be soecified either on command line as I showed or beforehand
set CLASSPATH=C:\folder\bin;c:
Id your main class is within package you'll have to use fully qualified name of your starting class with all packages finance.google.TestFinance Module
Better way would be to create executable .jar file
ASKER
Hello. Thank you!
I tried the steps for making an executable jar. I had already added in the external jar files using the Java Build Path and adding External Jars.
Does that mean that if I use the executable jar file I don't have to worry about the classpaths for these external jars?
In the file I attached to this question called sampleToAskAboutAccessingE clipse.jav a
on line 63 it declares an instance of the classes in the executable jar like this:
FinancePortfoliosClient cl = new FinancePortfoliosClient("f rom-mail.c om","to-ma il.com", "password");
What do I have to do now to make this executable jar (I called it test.jar) available to my program (sampleToAskAboutAccessing Eclipse.ja va)?
I tried the steps for making an executable jar. I had already added in the external jar files using the Java Build Path and adding External Jars.
Does that mean that if I use the executable jar file I don't have to worry about the classpaths for these external jars?
In the file I attached to this question called sampleToAskAboutAccessingE
on line 63 it declares an instance of the classes in the executable jar like this:
FinancePortfoliosClient cl = new FinancePortfoliosClient("f
What do I have to do now to make this executable jar (I called it test.jar) available to my program (sampleToAskAboutAccessing
Yes .... The export function from Eclipse is taking care on adding all needed classes into the executeable file ...
You just need to tick the tick on to include needed classes on the Project Export dialog.
You just need to tick the tick on to include needed classes on the Project Export dialog.
ASKER
Thanks. I am getting an Jar file “cannot find main class” error message when clicking on the jar file. But I did select the java file with the main in it when creating the jar.
You need to insert related "runtime configuration during creation". And class needed needs to contain related function in order to allow execution.....
public static void main(String[] args) {
}
Find attached some screenshots taken from Eclipse 3.7
Alternativly you can also let the wizard produce external directory containing all dependant classes and api's (Exluding those delivered from the JRE you are using)
exporting-Runnable-Jar-file.pdf
public static void main(String[] args) {
}
Find attached some screenshots taken from Eclipse 3.7
Alternativly you can also let the wizard produce external directory containing all dependant classes and api's (Exluding those delivered from the JRE you are using)
exporting-Runnable-Jar-file.pdf
ASKER
Thank you for the screen shots. I used the "package required libraries into generated Jar" option and now when I double click the resulting executable jar it does not give the error about main class but nothing happens. I guess that might be a good sign.
If that is a good sign, how can I arrange things so that I can use this jar to run my code. Specifically, this line:
FinancePortfoliosClient cl = new FinancePortfoliosClient("f rom-mail.c om","to-ma il.com", "password");
in my code requires the classes compressed in the executable jar (I called it test3.jar)
If that is a good sign, how can I arrange things so that I can use this jar to run my code. Specifically, this line:
FinancePortfoliosClient cl = new FinancePortfoliosClient("f
in my code requires the classes compressed in the executable jar (I called it test3.jar)
Well seems your program
At least it is better ... code is that one you atteched in your initial posting? or you changed meanwhile your main methode of your entry - class?
public static void main(String[] args) {
FinancePortfoliosClient cl = new FinancePortfoliosClient("f rom-mail.c om","to-ma il.com", "password");
}
After you can add something like cl.dothis(); cl.dothat(); whatever needs to be done in order to follow your required functionality. All within main method.
At least it is better ... code is that one you atteched in your initial posting? or you changed meanwhile your main methode of your entry - class?
public static void main(String[] args) {
FinancePortfoliosClient cl = new FinancePortfoliosClient("f
}
After you can add something like cl.dothis(); cl.dothat(); whatever needs to be done in order to follow your required functionality. All within main method.
You can use fatjar eclipse plugin
http://fjep.sourceforge.net/
or OneJar application to do it:
http://one-jar.sourceforge.net/
Or you can expand all your jars into your bin folder and it will repcakage them together
http://fjep.sourceforge.net/
or OneJar application to do it:
http://one-jar.sourceforge.net/
Or you can expand all your jars into your bin folder and it will repcakage them together
ASKER
Sorry, I meant, after I have created the executable, how do I let my program (the code I attached initially) know where this jar is and that it should use it and will this
FinancePortfoliosClient cl = new FinancePortfoliosClient("f rom-mail.c om","to-ma il.com", "password");
be enough to reference it?
Thanks again.
FinancePortfoliosClient cl = new FinancePortfoliosClient("f
be enough to reference it?
Thanks again.
You need to add youtr third party jar files to your executable jar and add classpath to manifest file.
I'm not sure Eclipse does it automatically when you have third party jars, that's why you need to use the FatJar plugin, which I posed the link above.
It will make it much easier
http://fjep.sourceforge.net/
The Fat Jar Eclipse Plug-In is a Deployment-Tool which deploys an Eclipse java-project into one executable jar.
It adds the Entry "Build Fat-JAR" to the Export-Wizard.
In addition to the eclipse standard jar-exporter referenced classes and jars are included to the "Fat-Jar", so the resulting jar contains all needed classes and can be executed directly with "java -jar", no classpath has to be set, no additional jars have to be deployed.
Jars, External-Jars, User-Libraries, System-Libraries, Classes-Folders and Project-Exports are considered by the plugin.
The Main-Class can be selected and Manifest-files are merged.
The One-JAR option integrates a specialised Class-Loader written by Simon Tuffs ( http://one-jar.sourceforge.net/ ) which handles jar-files inside a jar.
Individual files and folders can be excluded or added to the jar.
Different settings can be stored and re-executed as "Quick Build" via the context-menu.
I'm not sure Eclipse does it automatically when you have third party jars, that's why you need to use the FatJar plugin, which I posed the link above.
It will make it much easier
http://fjep.sourceforge.net/
The Fat Jar Eclipse Plug-In is a Deployment-Tool which deploys an Eclipse java-project into one executable jar.
It adds the Entry "Build Fat-JAR" to the Export-Wizard.
In addition to the eclipse standard jar-exporter referenced classes and jars are included to the "Fat-Jar", so the resulting jar contains all needed classes and can be executed directly with "java -jar", no classpath has to be set, no additional jars have to be deployed.
Jars, External-Jars, User-Libraries, System-Libraries, Classes-Folders and Project-Exports are considered by the plugin.
The Main-Class can be selected and Manifest-files are merged.
The One-JAR option integrates a specialised Class-Loader written by Simon Tuffs ( http://one-jar.sourceforge.net/ ) which handles jar-files inside a jar.
Individual files and folders can be excluded or added to the jar.
Different settings can be stored and re-executed as "Quick Build" via the context-menu.
hi,
can you add some debug code like
System.out.println("*** Program finished ***");
<added> Just because as i saw your code you sent initially - if you have list containing nothing (list != null) in this case execution would be empty as well and programm executed not as expected but all classes needed are included </added>
at the end of the main method. This should point out if the problem is in the jarfile you produced or in the source before.
Having no exception would show that all dependencies are fullfilled.
Coming back to your inital question ...
If just calling the constructor is sufficiant or not matters basically on the actual content of the class.
br
Pet.
Changed 16:44 with some addtional explainations
can you add some debug code like
System.out.println("*** Program finished ***");
<added> Just because as i saw your code you sent initially - if you have list containing nothing (list != null) in this case execution would be empty as well and programm executed not as expected but all classes needed are included </added>
at the end of the main method. This should point out if the problem is in the jarfile you produced or in the source before.
Having no exception would show that all dependencies are fullfilled.
Coming back to your inital question ...
If just calling the constructor is sufficiant or not matters basically on the actual content of the class.
br
Pet.
Changed 16:44 with some addtional explainations
I just followed the steps given here
http://askeralim.blogspot.com/2011/03/create-executable-jar-file-using.html
with one of my projects in Eclipse and it works fine
You just need to make sure that you specify correct Run Configuration - the same which is running the project for you in eclipse itslef
Then make sure that checkbox "Package required libarayes into jar" is checked
Then specify where to put the executable jar
Then open dos cmd window go to the folder where you have executable jar
and in that folder type on the command line
java -jar Jar_name.jar
It worked for me right now.
Should work for you also.
Just double-clicking on jar may not always work, so test form the command line
http://askeralim.blogspot.com/2011/03/create-executable-jar-file-using.html
with one of my projects in Eclipse and it works fine
You just need to make sure that you specify correct Run Configuration - the same which is running the project for you in eclipse itslef
Then make sure that checkbox "Package required libarayes into jar" is checked
Then specify where to put the executable jar
Then open dos cmd window go to the folder where you have executable jar
and in that folder type on the command line
java -jar Jar_name.jar
It worked for me right now.
Should work for you also.
Just double-clicking on jar may not always work, so test form the command line
ASKER
Hi. I am really confused. I just want my system to be able to run the code in the file I originally attached (sampleToAskAboutAccessing Eclipse.ja va). Actually I did not write the googlefinance code (the one that I made into an executable jar) and I really just wanted just a class that I could call from my sampleToAskAboutAccessingE clipse.jav a code but the person who created the googlefinance code used eclipse and so it is not a class but a whole project.
Perhaps if I add all the files in the lib folder to the class path manually (as described near the top of this discussion) this would be easiest.
By the way, in the screenshot, I forgot to say, the name of the project I am using is GoogleFinanceAndMail not Test or GoogleFinance.
You wrote:
"then you need to put on the classpath, and in this way yiou can start your application:
java -cp C:\foolder\bin;c:\folder\l ib\myjar1. jar;c:\fol der\lib\my jar3.jar.. . finance.google.TestFinance Module"
1) what is the -cp option?
2) I am not trying to run finance.google.TestFinanan ceModule as the main code, I am trying to run
sampleToAskAboutAccessingE clipse.jav a
so what is the command?
And do I follow these steps?
First do I have to set the class path with something like
set CLASSPATH=C:\folder\bin;c: \folder\li b\my.jar;. ..
And also, I should change any reference to the class to a fully qualified one
You wrote, "If your main class is within package you'll have to use fully qualified name of your starting class with all packages finance.google.TestFinance Module". I think there is a main class in finance.google.GoogleFinan ceAndMail but there is also a main class in sampleToAskAboutAccessingE clipse.jav a and I suppose that is the "true" main class for the whole of the code.
Perhaps if I add all the files in the lib folder to the class path manually (as described near the top of this discussion) this would be easiest.
By the way, in the screenshot, I forgot to say, the name of the project I am using is GoogleFinanceAndMail not Test or GoogleFinance.
You wrote:
"then you need to put on the classpath, and in this way yiou can start your application:
java -cp C:\foolder\bin;c:\folder\l
1) what is the -cp option?
2) I am not trying to run finance.google.TestFinanan
sampleToAskAboutAccessingE
so what is the command?
And do I follow these steps?
First do I have to set the class path with something like
set CLASSPATH=C:\folder\bin;c:
And also, I should change any reference to the class to a fully qualified one
You wrote, "If your main class is within package you'll have to use fully qualified name of your starting class with all packages finance.google.TestFinance
well, one thing - in most applciations bigger than Hello World, there are many classes and in one class you can create and use intances of another class, and then use third-party classes, so in fact you are not running "only one java file" - you are alwys running java application.
and java application is a collection of classes within the drirectory strictire (corresponding to packages) - and some of these classes you or your team created and so you have their sources and their classes are usually sitinng in the directory strauctire as class files. And also your application in most cases will use some classes from third party developwers and you'll not have source codes of those and you'll normally have those classes packaged in the .jar files. But inside your code - you'll use them basically in the same way as you use your own classes - isntaitaing instances of those classes and invoking methods on those instances.
So all these classes make up application - any you normally run the whole application - not one class.
Howeever within your application there may be one or serveral classes which have
public static void main(String args) method.
Those classes whch have this method can be used to start your application and
using different such "main" classes - you'll be starting your application from different "ends". Most probably you'll still use majority of all cvlasses prsent but because the main methdo is different you'll use them in different order and in this way you can achieve different functionality.
So starting with different main classwes you'll manipulate in different ways with the same collection of objects.
So if you do not meat to execute the main method in finance.google.GoogleFinan ceAndMail
but rather the main method in
sampleToAskAboutAccessingE clipse class - thatis perfectly fine - you still normally will need
to have all of your classes compiled and present but you'll use them in different order
and thus may achive different resulst.
and java application is a collection of classes within the drirectory strictire (corresponding to packages) - and some of these classes you or your team created and so you have their sources and their classes are usually sitinng in the directory strauctire as class files. And also your application in most cases will use some classes from third party developwers and you'll not have source codes of those and you'll normally have those classes packaged in the .jar files. But inside your code - you'll use them basically in the same way as you use your own classes - isntaitaing instances of those classes and invoking methods on those instances.
So all these classes make up application - any you normally run the whole application - not one class.
Howeever within your application there may be one or serveral classes which have
public static void main(String args) method.
Those classes whch have this method can be used to start your application and
using different such "main" classes - you'll be starting your application from different "ends". Most probably you'll still use majority of all cvlasses prsent but because the main methdo is different you'll use them in different order and in this way you can achieve different functionality.
So starting with different main classwes you'll manipulate in different ways with the same collection of objects.
So if you do not meat to execute the main method in finance.google.GoogleFinan
but rather the main method in
sampleToAskAboutAccessingE
to have all of your classes compiled and present but you'll use them in different order
and thus may achive different resulst.
>1) what is the -cp option?
so you can specify classpath in two ways.
One way is to set CLASSPATH env variable
and then start exceutio:
java fully_qualified_main_class _name
another way is to provbvide the classpath on the command line
In the latter cae you provide classpath after switch -cp after java command:
java -cp (at least one space) (classpath here) (at least one space here) fully_qualified_main_class _name
so you can specify classpath in two ways.
One way is to set CLASSPATH env variable
and then start exceutio:
java fully_qualified_main_class
another way is to provbvide the classpath on the command line
In the latter cae you provide classpath after switch -cp after java command:
java -cp (at least one space) (classpath here) (at least one space here) fully_qualified_main_class
You don't need to do both.
If you proveide classpath in env variable, then you don't need to have it on the command line
If you proveide classpath in env variable, then you don't need to have it on the command line
If your "main" class is in the package, like
finance.google.TestFinance
(then its fierst statement (in Java code) must be
package finance.google;
\then you start it with fully qualified name
if there is no package statemnt in the begonning of the file - then it is called "default" pacakge;
then you jsut start
java sampleToAskAboutAccessingE clipse
(assume that there is no package statement on top of the latter java file)
finance.google.TestFinance
(then its fierst statement (in Java code) must be
package finance.google;
\then you start it with fully qualified name
if there is no package statemnt in the begonning of the file - then it is called "default" pacakge;
then you jsut start
java sampleToAskAboutAccessingE
(assume that there is no package statement on top of the latter java file)
ASKER
Thank you. This was very helpful "Those classes whch have this method can be used to start your application and using different such "main" classes - you'll be starting your application from different "ends". " and in fact that entire comment was very helpful.
So, I will be using the file called sampleToAskAboutAccessingE clipse, which is one of the files that has a main method in it, to start the program.
Now is the package called GoogleFinanceAndMail or is it called finance.google? I guess from what you have said above that the package is finance.google and the project name is GoogleFinanceAndMail and that this project name has nothing to do with referencing the classes.
I created the executable jar. The latest version is called test3.jar. I have put in in the CLASSPATH variable as well.
Here are my results.
C:\Users\Bill\Desktop\chat vestor\tes t>javac JavaWekaJ48TestTrainPredSQ L_updated5 .java
Note: JavaWekaJ48TestTrainPredSQ L_updated5 .java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
C:\Users\Bill\Desktop\chat vestor\tes t>java JavaWekaJ48TestTrainPredSQ L_updated5
Exception in thread "main" java.lang.NoClassDefFoundE rror: com/google/gdata/util/Auth enticat
ionException
at JavaWekaJ48TestTrainPredSQ L_updated5 .main(Java WekaJ48Tes tTrainPred SQL_update d5.ja
va:63)
Caused by: java.lang.ClassNotFoundExc eption: com.google.gdata.util.Auth entication Exception
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:366)
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:355)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(UR LClassLoad er.java:35 4)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:423)
at sun.misc.Launcher$AppClass Loader.loa dClass(Lau ncher.java :308)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:356)
... 1 more
C:\Users\Bill\Desktop\chat vestor\tes t>
any ideas on this? Thanks.
So, I will be using the file called sampleToAskAboutAccessingE
Now is the package called GoogleFinanceAndMail or is it called finance.google? I guess from what you have said above that the package is finance.google and the project name is GoogleFinanceAndMail and that this project name has nothing to do with referencing the classes.
I created the executable jar. The latest version is called test3.jar. I have put in in the CLASSPATH variable as well.
Here are my results.
C:\Users\Bill\Desktop\chat
Note: JavaWekaJ48TestTrainPredSQ
Note: Recompile with -Xlint:unchecked for details.
C:\Users\Bill\Desktop\chat
Exception in thread "main" java.lang.NoClassDefFoundE
ionException
at JavaWekaJ48TestTrainPredSQ
va:63)
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader$1.
at java.net.URLClassLoader$1.
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
... 1 more
C:\Users\Bill\Desktop\chat
any ideas on this? Thanks.
the package is finace.google
project is GoogleFinanceAndMail
project is more or less synonymic to application
and project can have many packages
project or application name have nothing to do with referencing classes
the reason for the exception most probably is that in classpath you are lacking jar which contains class
com.google.gdata.util.Auth entication Exception
which is necessary for execution of your application
project is GoogleFinanceAndMail
project is more or less synonymic to application
and project can have many packages
project or application name have nothing to do with referencing classes
the reason for the exception most probably is that in classpath you are lacking jar which contains class
com.google.gdata.util.Auth
which is necessary for execution of your application
did you have all jars which we see in the snapshot in the classpath ?
i guess some of those google jars should contain this lacking class
i guess some of those google jars should contain this lacking class
ASKER
I thought I created the executable jar after adding in those google jars as external jars. Maybe I need the fatjar?
P.S. This was helpful too "and project can have many packages"
P.S. This was helpful too "and project can have many packages"
well it should work
but I don't know how you finally did it
did you create executable jar with eclipse after all or you just specified classpath enumerating all jars manually?
if the latter is true, then check if you by chance omitted some jar
but I don't know how you finally did it
did you create executable jar with eclipse after all or you just specified classpath enumerating all jars manually?
if the latter is true, then check if you by chance omitted some jar
ASKER
I am attaching the steps I used to make the executable jar. You can see how at the beginning I added the jars in the libs folder. I selected all of them at once in the dialog box called JAR Selection that is a file chooser.
steps-to-make-executable-jar.pdf
steps-to-make-executable-jar.pdf
I am not sure I understand what is this picture about.
I actually strictly folloewed this instruction
http://askeralim.blogspot.com/2011/03/create-executable-jar-file-using.html
this morning
with one of my simple projects and I got vereything packaged into jar and was able to execute this jar
with command j
java -jar jar_name.jar
Didn't you try it this way?
Ecexecutable jar relies on the particluar run configuration,
so for raunning form one "main" class and running for another "main"
class you'll need to create two different executable jars.
Other than that I would still try to do it this way.
You should be sure first that you have appropruiate run configuration and
and check that this run configuration is executing without mistakes from eclipse enviroenemnet
in the normal eclipse way
also make sure to chack that the checkbox
package in depenedent jars (or soemthing like that)
is checked
and in this way you'll avoid choseing and selecting jars manually
I actually strictly folloewed this instruction
http://askeralim.blogspot.com/2011/03/create-executable-jar-file-using.html
this morning
with one of my simple projects and I got vereything packaged into jar and was able to execute this jar
with command j
java -jar jar_name.jar
Didn't you try it this way?
Ecexecutable jar relies on the particluar run configuration,
so for raunning form one "main" class and running for another "main"
class you'll need to create two different executable jars.
Other than that I would still try to do it this way.
You should be sure first that you have appropruiate run configuration and
and check that this run configuration is executing without mistakes from eclipse enviroenemnet
in the normal eclipse way
also make sure to chack that the checkbox
package in depenedent jars (or soemthing like that)
is checked
and in this way you'll avoid choseing and selecting jars manually
ASKER
Hi. I did not do
java -jar jar_name.jar
because the file I want to run (and the main method I want to run) is in the file
sampleToAskAboutAccessingE clipse.jav a
(in the error message I showed above I called this same file "JavaWekaJ48TestTrainPredS QL_updated 5" and so I ran it like
java JavaWekaJ48TestTrainPredSQ L_updated5 ).
But I did have the executable jar test3.jar in the classpath.
Is this incorrect?
Thank you.
java -jar jar_name.jar
because the file I want to run (and the main method I want to run) is in the file
sampleToAskAboutAccessingE
(in the error message I showed above I called this same file "JavaWekaJ48TestTrainPredS
java JavaWekaJ48TestTrainPredSQ
But I did have the executable jar test3.jar in the classpath.
Is this incorrect?
Thank you.
I don't know if it is incorrect, but it is not undersatdnable to me
How cna you call the same file
this way
sampleToAskAboutAccessingE clipse.jav a
and this way
JavaWekaJ48TestTrainPredSQ L_updated5
all this is not quite understandble
So my fisrt question is - can you run your applictaion in Eclipse
in noraml way as people noramlly run it in IDE ?
If you can - you must have run configuration which works for you
(Run Configuration is the place where you indeicate which is the "main" class)
If you have all that, why would not you just follow
the way they do it in the lionk I posted above?
How cna you call the same file
this way
sampleToAskAboutAccessingE
and this way
JavaWekaJ48TestTrainPredSQ
all this is not quite understandble
So my fisrt question is - can you run your applictaion in Eclipse
in noraml way as people noramlly run it in IDE ?
If you can - you must have run configuration which works for you
(Run Configuration is the place where you indeicate which is the "main" class)
If you have all that, why would not you just follow
the way they do it in the lionk I posted above?
ASKER
Hi. Very sorry for the confusion.
I have two names for the same code.
sampleToAskAboutAccessingE clipse.jav a
and
JavaWekaJ48TestTrainPredSQ L_updated5 .java
I also have the executable jar which I created from the GoogleFinanceAndMail Eclipse project. This executable is called
test3.jar.
This test3.jar executable jar contains code that allows me to access the Google Finance API. But the code in JavaWekaJ48TestTrainPredSQ L_updated5 .java is my main code and does a lot more than access Google Finance. But within JavaWekaJ48TestTrainPredSQ L_updated5 .java I need to access the Google Finance API and that is why I need to have access to test3.jar.
So I did not think I want to run this command:
java -jar test3.jar
because that is not the main code. The main code is in JavaWekaJ48TestTrainPredSQ L_updated5 .java but within there I need to access Google Finance and so I also need test.jar.
However, when I tried to run JavaWekaJ48TestTrainPredSQ L_updated5 .java, I get the following:
C:\Users\Bill\Desktop\chat vestor\tes t>javac JavaWekaJ48TestTrainPredSQ L_updated5 .java
Note: JavaWekaJ48TestTrainPredSQ L_updated5 .java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
C:\Users\Bill\Desktop\chat vestor\tes t>java JavaWekaJ48TestTrainPredSQ L_updated5
Exception in thread "main" java.lang.NoClassDefFoundE rror: com/google/gdata/util/Auth enticat
ionException
at JavaWekaJ48TestTrainPredSQ L_updated5 .main(Java WekaJ48Tes tTrainPred SQL_update d5.ja
va:63)
Caused by: java.lang.ClassNotFoundExc eption: com.google.gdata.util.Auth entication Exception
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:366)
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:355)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(UR LClassLoad er.java:35 4)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:423)
at sun.misc.Launcher$AppClass Loader.loa dClass(Lau ncher.java :308)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:356)
... 1 more
Thanks.
I have two names for the same code.
sampleToAskAboutAccessingE
and
JavaWekaJ48TestTrainPredSQ
I also have the executable jar which I created from the GoogleFinanceAndMail Eclipse project. This executable is called
test3.jar.
This test3.jar executable jar contains code that allows me to access the Google Finance API. But the code in JavaWekaJ48TestTrainPredSQ
So I did not think I want to run this command:
java -jar test3.jar
because that is not the main code. The main code is in JavaWekaJ48TestTrainPredSQ
However, when I tried to run JavaWekaJ48TestTrainPredSQ
C:\Users\Bill\Desktop\chat
Note: JavaWekaJ48TestTrainPredSQ
Note: Recompile with -Xlint:unchecked for details.
C:\Users\Bill\Desktop\chat
Exception in thread "main" java.lang.NoClassDefFoundE
ionException
at JavaWekaJ48TestTrainPredSQ
va:63)
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader$1.
at java.net.URLClassLoader$1.
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
... 1 more
Thanks.
>C:\Users\Bill\Desktop\cha tvestor\te st>javac JavaWekaJ48TestTrainPredSQ L_updated5 .java
Note: JavaWekaJ48TestTrainPredSQ L_updated5 .java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
this is fine, don't pay attention to the warnings
if your googglefinace which you need to access are in test.jar, then you need to have it in the same dfolder and run it like that:
java -cp .\;.\test.jar JavaWekaJ48TestTrainPredSQ L_updated5
Note: JavaWekaJ48TestTrainPredSQ
Note: Recompile with -Xlint:unchecked for details.
this is fine, don't pay attention to the warnings
if your googglefinace which you need to access are in test.jar, then you need to have it in the same dfolder and run it like that:
java -cp .\;.\test.jar JavaWekaJ48TestTrainPredSQ
ASKER
Thanks. I moved it to the same folder and ran as java -cp .\;.\test.jar JavaWekaJ48TestTrainPredSQ L_updated5 but I got an error. Then I ran as
java JavaWekaJ48TestTrainPredSQ L_updated5 and got a different error (see below). My classpath is here:
.;C:\Program Files\Weka-3-7\weka.jar;C: \Program Files\Java\jre6\lib\ext\QT Java.zip;C :\Program Files\Weka-3-7\mysql-conne ctor-java- 5.1.18\mys ql-connect or-java-5. 1.18-bin.j ar;C:\User s\Bill\Des ktop\chatv estor\test \test3.jar
C:\Users\Bill\Desktop\chat vestor\tes t>java -cp .\;.\test.jar JavaWekaJ48TestTrainPredSQ L_upd
ated5
Exception in thread "main" java.lang.NoClassDefFoundE rror: weka/classifiers/Classifie r
at java.lang.Class.getDeclare dMethods0( Native Method)
at java.lang.Class.privateGet DeclaredMe thods(Clas s.java:244 2)
at java.lang.Class.getMethod0 (Class.jav a:2685)
at java.lang.Class.getMethod( Class.java :1620)
at sun.launcher.LauncherHelpe r.getMainM ethod(Laun cherHelper .java:484)
at sun.launcher.LauncherHelpe r.checkAnd LoadMain(L auncherHel per.java:4 76)
Caused by: java.lang.ClassNotFoundExc eption: weka.classifiers.Classifie r
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:366)
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:355)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(UR LClassLoad er.java:35 4)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:423)
at sun.misc.Launcher$AppClass Loader.loa dClass(Lau ncher.java :308)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:356)
... 6 more
C:\Users\Bill\Desktop\chat vestor\tes t>java JavaWekaJ48TestTrainPredSQ L_updated5
Exception in thread "main" java.lang.NoClassDefFoundE rror: com/google/gdata/util/Auth enticat
ionException
at JavaWekaJ48TestTrainPredSQ L_updated5 .main(Java WekaJ48Tes tTrainPred SQL_update d5.ja
va:63)
Caused by: java.lang.ClassNotFoundExc eption: com.google.gdata.util.Auth entication Exception
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:366)
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:355)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(UR LClassLoad er.java:35 4)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:423)
at sun.misc.Launcher$AppClass Loader.loa dClass(Lau ncher.java :308)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:356)
... 1 more
java JavaWekaJ48TestTrainPredSQ
.;C:\Program Files\Weka-3-7\weka.jar;C:
C:\Users\Bill\Desktop\chat
ated5
Exception in thread "main" java.lang.NoClassDefFoundE
at java.lang.Class.getDeclare
at java.lang.Class.privateGet
at java.lang.Class.getMethod0
at java.lang.Class.getMethod(
at sun.launcher.LauncherHelpe
at sun.launcher.LauncherHelpe
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader$1.
at java.net.URLClassLoader$1.
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
... 6 more
C:\Users\Bill\Desktop\chat
Exception in thread "main" java.lang.NoClassDefFoundE
ionException
at JavaWekaJ48TestTrainPredSQ
va:63)
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader$1.
at java.net.URLClassLoader$1.
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
... 1 more
don't understad what you are writing.
where are your clasess like com/google/gdata/util/...
are they in test3.jar ?
If so - put test3.jar in the calsspath
wherea are your clasess like
weka/classifiers/Classifie r
in weka.jar ?
make sure that weka.jar is in the classpath
make sure taht all classes which you need are on the classpath and then run
if you use CLASSAPTH as env varaible, then put everything in the env variable
otherwise put everything after -cp on the command line
Don't copmbine the two ways.
where are your clasess like com/google/gdata/util/...
are they in test3.jar ?
If so - put test3.jar in the calsspath
wherea are your clasess like
weka/classifiers/Classifie
in weka.jar ?
make sure that weka.jar is in the classpath
make sure taht all classes which you need are on the classpath and then run
if you use CLASSAPTH as env varaible, then put everything in the env variable
otherwise put everything after -cp on the command line
Don't copmbine the two ways.
If you need test.jar then add it to CLASSPATH variable, if everything elase in CLASSPATH variable -cp switch will override your CLASPATH and you'll lose what is on the CLASSPATH
so don't combine two methods - use consistently one of the two methods
so don't combine two methods - use consistently one of the two methods
ASKER
Hello. I have both weka.jar and test3.jar in my system classpath variable:
.;C:\Program Files\Weka-3-7\weka.jar;C: \Program Files\Java\jre6\lib\ext\QT Java.zip;C :\Program Files\Weka-3-7\mysql-conne ctor-java- 5.1.18\mys ql-connect or-java-5. 1.18-bin.j ar;C:\User s\Bill\Des ktop\chatv estor\test \test3.jar
In that case shouldn't I run
java JavaWekaJ48TestTrainPredSQ L_updated5
But I get the error:
C:\Users\Bill\Desktop\chat vestor\tes t>java JavaWekaJ48TestTrainPredSQ L_updated5
Exception in thread "main" java.lang.NoClassDefFoundE rror: com/google/gdata/util/Auth enticat
ionException
at JavaWekaJ48TestTrainPredSQ L_updated5 .main(Java WekaJ48Tes tTrainPred SQL_update d5.ja
va:63)
Caused by: java.lang.ClassNotFoundExc eption: com.google.gdata.util.Auth entication Exception
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:366)
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:355)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(UR LClassLoad er.java:35 4)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:423)
at sun.misc.Launcher$AppClass Loader.loa dClass(Lau ncher.java :308)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:356)
... 1 more
.;C:\Program Files\Weka-3-7\weka.jar;C:
In that case shouldn't I run
java JavaWekaJ48TestTrainPredSQ
But I get the error:
C:\Users\Bill\Desktop\chat
Exception in thread "main" java.lang.NoClassDefFoundE
ionException
at JavaWekaJ48TestTrainPredSQ
va:63)
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader$1.
at java.net.URLClassLoader$1.
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
... 1 more
ASKER
Hello. I have both weka.jar and test3.jar in my system classpath variable:
.;C:\Program Files\Weka-3-7\weka.jar;C:\Program Files\Java\jre6\lib\ext\QT Java.zip;C :\Program Files\Weka-3-7\mysql-conne ctor-java- 5.1.18\mys ql-connect or-java-5. 1.18-bin.j ar;C:\Users\Bill\Desktop\chat vestor\tes t\test3.ja r
In that case shouldn't I run
java JavaWekaJ48TestTrainPredSQ L_updated5
But I get the error:
C:\Users\Bill\Desktop\chat vestor\tes t>java JavaWekaJ48TestTrainPredSQ L_updated5
Exception in thread "main" java.lang.NoClassDefFoundE rror: com/google/gdata/util/Auth enticat
ionException
at JavaWekaJ48TestTrainPredSQ L_updated5 .main(Java WekaJ48Tes tTrainPred SQL_update d5.ja
va:63)
Caused by: java.lang.ClassNotFoundExc eption: com.google.gdata.util.Auth entication Exception
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:366)
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:355)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(UR LClassLoad er.java:35 4)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:423)
at sun.misc.Launcher$AppClass Loader.loa dClass(Lau ncher.java :308)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:356)
... 1 more
.;C:\Program Files\Weka-3-7\weka.jar;C:\Program Files\Java\jre6\lib\ext\QT
In that case shouldn't I run
java JavaWekaJ48TestTrainPredSQ
But I get the error:
C:\Users\Bill\Desktop\chat
Exception in thread "main" java.lang.NoClassDefFoundE
ionException
at JavaWekaJ48TestTrainPredSQ
va:63)
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader$1.
at java.net.URLClassLoader$1.
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
... 1 more
I think it means that you don't have
com/google/gdata/util/Auth entication Exception. class
in your test3.jar
and understand that if you have some jar embedded in test3.jar which has that class inside that embedded jar then it is not enouough- you need to have this class in test3.jar in the folder structure
com/google/gdata/util/Auth entication Exception. class
otherwise it would not work
com/google/gdata/util/Auth
in your test3.jar
and understand that if you have some jar embedded in test3.jar which has that class inside that embedded jar then it is not enouough- you need to have this class in test3.jar in the folder structure
com/google/gdata/util/Auth
otherwise it would not work
ASKER
How do I check if this is in my test.jar com/google/gdata/util/Auth entication Exception. class ?
Here is a screen shot of the external jars I added to the project in eclipse.
lib-jar-files.PNG
Here is a screen shot of the external jars I added to the project in eclipse.
lib-jar-files.PNG
copy test3.jar to test3.zip and open it with winzip
But if you have jars zipped-in into test3.jar and your class is in one of those
emvbeded jars - tthen it will not work this way
But if you have jars zipped-in into test3.jar and your class is in one of those
emvbeded jars - tthen it will not work this way
you need to put all those jars in the same folder explicitly (not inside any jars)
and add them one by one to your CLASSPATH
and add them one by one to your CLASSPATH
ASKER
Here is my manifest
Manifest-Version: 1.0
Rsrc-Class-Path: ./ xmlParserAPIs-2.2.1.jar gdata-finance-meta-2.0.jar
gdata-maps-2.0.jar gdata-core-1.0.jar gdata-client-1.0.jar servlet-a
pi.jar google-collect-1.0-rc1.jar gdata-maps-meta-2.0.jar mail.jar ac
tivation.jar gdata-client-meta-1.0.jar gdata-finance-2.0.jar
Class-Path: .
Rsrc-Main-Class: finance.google.TestFinance Module
Main-Class: org.eclipse.jdt.internal.j arinjarloa der.JarRsr cLoader
Manifest-Version: 1.0
Rsrc-Class-Path: ./ xmlParserAPIs-2.2.1.jar gdata-finance-meta-2.0.jar
gdata-maps-2.0.jar gdata-core-1.0.jar gdata-client-1.0.jar servlet-a
pi.jar google-collect-1.0-rc1.jar
tivation.jar gdata-client-meta-1.0.jar gdata-finance-2.0.jar
Class-Path: .
Rsrc-Main-Class: finance.google.TestFinance
Main-Class: org.eclipse.jdt.internal.j
ASKER
test3.jar has inside it the jar files in the attached screen shot. But how do I know if com/google/gdata/util/Auth entication Exception. class is in here?
Here is my manifest
Manifest-Version: 1.0
Rsrc-Class-Path: ./ xmlParserAPIs-2.2.1.jar gdata-finance-meta-2.0.jar
gdata-maps-2.0.jar gdata-core-1.0.jar gdata-client-1.0.jar servlet-a
pi.jar google-collect-1.0-rc1.jar gdata-maps-meta-2.0.jar mail.jar ac
tivation.jar gdata-client-meta-1.0.jar gdata-finance-2.0.jar
Class-Path: .
Rsrc-Main-Class: finance.google.TestFinance Module
Main-Class: org.eclipse.jdt.internal.j arinjarloa der.JarRsr cLoader
tstjar.PNG
Here is my manifest
Manifest-Version: 1.0
Rsrc-Class-Path: ./ xmlParserAPIs-2.2.1.jar gdata-finance-meta-2.0.jar
gdata-maps-2.0.jar gdata-core-1.0.jar gdata-client-1.0.jar servlet-a
pi.jar google-collect-1.0-rc1.jar
tivation.jar gdata-client-meta-1.0.jar gdata-finance-2.0.jar
Class-Path: .
Rsrc-Main-Class: finance.google.TestFinance
Main-Class: org.eclipse.jdt.internal.j
tstjar.PNG
Once again, do you want to do it through eclipse - do it exactly as here
http://askeralim.blogspot.com/2011/03/create-executable-jar-file-using.html
and don't drop on top of it still one more java file - evrything should be there, should be Run Configuration ansd agaian everything as I was talking before
with another RunConfiguratein - create another new full jar file
I was thinkning that we are now doing it manually without eclipse.
with eclipsee follow the instruuctions
http://askeralim.blogspot.com/2011/03/create-executable-jar-file-using.html
and don't drop on top of it still one more java file - evrything should be there, should be Run Configuration ansd agaian everything as I was talking before
with another RunConfiguratein - create another new full jar file
I was thinkning that we are now doing it manually without eclipse.
with eclipsee follow the instruuctions
>But how do I know if com/google/gdata/util/Auth entication Exception. class is in here?
But I just told you - copy it to test3.zip and open with winzip -and look at the files there
But I just told you - copy it to test3.zip and open with winzip -and look at the files there
ASKER
No I want to do it manually, not with eclipse.
ASKER
I did look at the files but I only see the 13 jar files in the screen shot I attached. Should I do the same with each of them (change to zip and look for it in each of them)?
Ok, forget about all of that
and follow my instaructions step by sterp exactly:
Go to your Eclipse project - excute in eclipse exactly as you want to execute it outside arrting with the same main class - and report to me that it is executing as you want
and follow my instaructions step by sterp exactly:
Go to your Eclipse project - excute in eclipse exactly as you want to execute it outside arrting with the same main class - and report to me that it is executing as you want
and report to me that it is executing as you want from within eclipse
ASKER
Thanks. I cannot really use eclipse. That is why I wanted to use the command line. My main code is just in one class file and I have been running it without problem
(as java JavaWekaJ48TestTrainPredSQ L_updated5 )
but now I have this extra google.finance and it was done in eclipse but that is only the small functionality of accessing google finance. My main code is just in one class file that I run through the command line. I don't know how to use eclipse well.
(as java JavaWekaJ48TestTrainPredSQ
but now I have this extra google.finance and it was done in eclipse but that is only the small functionality of accessing google finance. My main code is just in one class file that I run through the command line. I don't know how to use eclipse well.
Ok, then it probably will not work as it never worked this way and was not dbugged properly, etc.
OK, does your JavaWekaJ48TestTrainPredSQ L_updated5 .java has any package statement at the very top of your code ?
OK, does your JavaWekaJ48TestTrainPredSQ
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
THANK YOU SO MUCH (as always) for your help. I think I should try it another way for now.
SO you didn't try it this way as in the last posting?
ASKER
Ok, I am going to try it now.
Try, I think it should work if it is in general compatible
ASKER
Hello. I put the weka.jar file in the folder as well. (Note also: From the Eclipse project there were several class files. )
Here is what I ran:
C:\Users\Bill\Desktop\test bed\bin\finance\google>jav a -cp .\;xmlParserAPIs-2.2.1.jar ;.\acti
vation.jar;.\gdata-client- 1.0.jar;.\ gdata-clie nt-meta-1. 0.jar;.\gd ata-core-1 .0.jar;.\g data-f
inance-2.0.jar;.\gdata-fin ance-meta- 2.0.jar;.\ gdata-maps -2.0.jar;. \gdata-map s-meta-2.0 .jar;.
\google-collect-1.0-rc1.ja r;.\mail.j ar;.\servl et-api.jar ;.\weka.ja r JavaWekaJ48TestTrainPred
SQL_updated5
Exception in thread "main" java.lang.NoClassDefFoundE rror: finance/google/FinancePort foliosC
lient
at JavaWekaJ48TestTrainPredSQ L_updated5 .main(Java WekaJ48Tes tTrainPred SQL_update d5.ja
va:63)
Caused by: java.lang.ClassNotFoundExc eption: finance.google.FinancePort foliosClie nt
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:366)
at java.net.URLClassLoader$1. run(URLCla ssLoader.j ava:355)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(UR LClassLoad er.java:35 4)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:423)
at sun.misc.Launcher$AppClass Loader.loa dClass(Lau ncher.java :308)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:356)
... 1 more
C:\Users\Bill\Desktop\test bed\bin\finance\google>
Here is what I ran:
C:\Users\Bill\Desktop\test
vation.jar;.\gdata-client-
inance-2.0.jar;.\gdata-fin
\google-collect-1.0-rc1.ja
SQL_updated5
Exception in thread "main" java.lang.NoClassDefFoundE
lient
at JavaWekaJ48TestTrainPredSQ
va:63)
Caused by: java.lang.ClassNotFoundExc
at java.net.URLClassLoader$1.
at java.net.URLClassLoader$1.
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
... 1 more
C:\Users\Bill\Desktop\test
to what folder did you copy the whole bin folder form eclipse?
It is suspicious why you run it form
this folder
C:\Users\Bill\Desktop\test bed\bin\finance\google>
and not from this folder:
C:\Users\Bill\Desktop\test bed\bin>
Youshould copy the bbin folder andf do everything in that copy folder and run from there - read attetively wbhhat I wrote - it is all important!
It is suspicious why you run it form
this folder
C:\Users\Bill\Desktop\test
and not from this folder:
C:\Users\Bill\Desktop\test
Youshould copy the bbin folder andf do everything in that copy folder and run from there - read attetively wbhhat I wrote - it is all important!
ASKER
Hi. OK, now it is looking better. I did it in the bin folder. I am now getting an error about Invalid Credentials. It says Captcha required. When I ran just the Eclipse code in Eclipse (in other words not the JavaWekaJ48TestTrainPredSQ L_updated5 file) it said there were some errors "Errors exist in required project" "Proceed to launch?" but it did run and get the results from Google but here it does not and says captcha required.
C:\Users\Bill\Desktop\test bed\bin>java -cp .\;xmlParserAPIs-2.2.1.jar ;.\activat ion.jar;.\ gd
ata-client-1.0.jar;.\gdata -client-me ta-1.0.jar ;.\gdata-c ore-1.0.ja r;.\gdata- finance-2. 0.jar;
.\gdata-finance-meta-2.0.j ar;.\gdata -maps-2.0. jar;.\gdat a-maps-met a-2.0.jar; .\google-c ollect
-1.0-rc1.jar;.\mail.jar;.\ servlet-ap i.jar;.\we ka.jar JavaWekaJ48TestTrainPredSQ L_updated5
Invalid Credentials!
com.google.gdata.client.Go ogleServic e$CaptchaR equiredExc eption: Captcha required
at com.google.gdata.client.Go ogleAuthTo kenFactory .getAuthEx ception(Go ogleAuthTo kenFa
ctory.java:623)
at com.google.gdata.client.Go ogleAuthTo kenFactory .getAuthTo ken(Google AuthTokenF actor
y.java:500)
at com.google.gdata.client.Go ogleAuthTo kenFactory .setUserCr edentials( GoogleAuth Token
Factory.java:346)
at com.google.gdata.client.Go ogleServic e.setUserC redentials (GoogleSer vice.java: 362)
at com.google.gdata.client.Go ogleServic e.setUserC redentials (GoogleSer vice.java: 317)
at com.google.gdata.client.Go ogleServic e.setUserC redentials (GoogleSer vice.java: 301)
at finance.google.FinancePort foliosClie nt.loginUs er(Finance Portfolios Client.jav a:224
)
at finance.google.FinancePort foliosClie nt.<init>( FinancePor tfoliosCli ent.java:8 3)
at JavaWekaJ48TestTrainPredSQ L_updated5 .main(Java WekaJ48Tes tTrainPred SQL_update d5.ja
va:63)
C:\Users\Bill\Desktop\test
ata-client-1.0.jar;.\gdata
.\gdata-finance-meta-2.0.j
-1.0-rc1.jar;.\mail.jar;.\
Invalid Credentials!
com.google.gdata.client.Go
at com.google.gdata.client.Go
ctory.java:623)
at com.google.gdata.client.Go
y.java:500)
at com.google.gdata.client.Go
Factory.java:346)
at com.google.gdata.client.Go
at com.google.gdata.client.Go
at com.google.gdata.client.Go
at finance.google.FinancePort
)
at finance.google.FinancePort
at JavaWekaJ48TestTrainPredSQ
va:63)
Well this is absolutely another story - invalid credentials - perhaps to login somehwere - this inside your aplication. - it is insignificant that it was running in eclipse - it was saying that there are some errors in differnet part of the project not exactly within your execution path. In this case your execution path is different and you need to know where youi have wrong credentials. Think what credentials you are providing and try to understand.
ASKER
Thanks again. It is working it seems except for the credentials. I will try to get that fixed.
It seems this google piece requiressome authentication - make sure you are providing valid user/password to access those
ASKER
Yes. I have looked up the error. Seems that sometimes it happens. I saw this and tried it but still got the error.
Your application can direct the user to the Google hosted page:
https://www.google.com/a/yourdomain.com/UnlockCaptcha
Note: Please replace yourdomain.com with your domain name.
Once the user has successfully responded to the challenge, the Google
server will trust the computer in use. The application can then resend
the original login request to obtain the authentication token."
Your application can direct the user to the Google hosted page:
https://www.google.com/a/yourdomain.com/UnlockCaptcha
Note: Please replace yourdomain.com with your domain name.
Once the user has successfully responded to the challenge, the Google
server will trust the computer in use. The application can then resend
the original login request to obtain the authentication token."
well, that is way beyond your original question
I don't know how google.finance is organizes - I know usually with google you need to have an account ansd they send you some token which you need to them for authentication.
perhpas read this:
https://developers.google.com/finance/docs/2.0/developers_guide_java#Authenticating
I don't know how google.finance is organizes - I know usually with google you need to have an account ansd they send you some token which you need to them for authentication.
perhpas read this:
https://developers.google.com/finance/docs/2.0/developers_guide_java#Authenticating
let's assume thet your jars are in the folder lib of your project
then you need to put on the classpath, and in this way yiou can start your application:
java -cp C:\foolder\bin;c:\folder\l