Jar file could not find main class.. I cant see why?

Advertisement

I have read loads of tutorials on this and it should be very straight forward but i STILL cant make a working jar file of my program.. please see if you can see anything wrong with what im doing..
my program is one .java file that compiles perfectly, and is runnable both through eclipse and by using the command prompt.. i made a jar file using both eclipse and the command prompt, and neither worked.. every time i run it by double clicking it i get the error "could not find main class, program will exit". here is the contents of my jar:
CorePackage\IPEmailer.class
CorePackage\IPEmailer$1.class
CorePackage\IPEmailer$SMTPAuthenticator.class
META-INF\MANIFEST.MF
the MANIFEST.MF file contains:
Manifest-Version: 1.0
Class-path: .
Created-By: 1.6.0_02 (Sun Microsystems Inc.)
Main-Class: CorePackage.IPEmailer
(yes there is a blank line at the end)
the class mentioned in 'Main-Class' has a main method that looks like this:
public static void main(String[] args) {
    // TODO Auto-generated method stub
    new IPEmailer();
}the program uses 2 external jar files:
activation.jar
mail.jar
and reads a file called:
ipemailer.ini
and writes a file called:
ip.txt
the program has no GUI and is intended to run 'silently' in the background
please help me understand what is wrong with this

Advertisement

package CorePackage;
import javax.mail.*;
import javax.mail.Authenticator;
import javax.mail.PasswordAuthentication;
import javax.mail.internet.*;
import java.util.*;
import java.io.*;
import java.net.*;
public class IPEmailer implements Runnable{
      * @param args
     String recipientsinput[]={""};
     String subject;
     String body;
     String server;
     String user;
     String pass;
     String from;
     String urlString = "http://www.whatismyip.org";
     String currentIP;
     String ipFromFile;
     boolean webFailed;
     long interval = 900000; //15 mins
     long oldInterval;
     Thread t = new Thread(this);
     public static void main(String[] args) {
          // TODO Auto-generated method stub
          new IPEmailer();
     public IPEmailer(){
                     ..........etccould the problem be that the class is a thread? i cant see why it would be, but ive never made a jar where the main class also 'implements runnable'

October 11, 2015

Jar file could not find main class.. I cant see why?

I have read loads of tutorials on this and it should be very straight forward but i STILL cant make a working jar file of my program.. please see if you can see anything wrong with what im doing.. my program is one .java file that compiles perfectly,

Jar file error: could not find main class. program will exit

I have created a jar file using following command jar cfm MyProj.jar Manifest.txt richa\*.class and I have included main class header in the Manifest.txt. The executable jar file is created but when I double click on it, it prompts an error Could not

Executable JAR file: Could not find the main class.

Hello, I have a problem with making an executable JAR file. I have written a JAVA program that consists of five different classes of which User.java is the main class and I have saved a text document with Main-Class: User and a blank line after that.

Java Virtual Machine. Could not find main class

I am trying to install Oracle Data Access Components ODAC 11g 11.1.0.6.21 on windows 2008. I get the dreaded could not find the main class. Program will ext. I have seen all the post, tried installing every conceivable Java version, removed all java

Could not find main class - Java virtual machine launcher error

Hi, I tried executing the following cmd, below is the following error: <<command i executed>> C:\Program Files\Java\jre1.5.0_09\bin>java -classpath "C:\Program Files\Java\jre1.5.0_09\lib\javaws.jar" com.sun.javaws.Main https://<

Error when deleting file: Could not find this item. This is no longer located in ...

We are setting up a new Windows 2012 server. Users access this server using a 'terminal services'. We have mapped some folders from a legacy server (different domain). Using group policy preferences, we map this folder as a drive for a user. When use

JAR "could not find the main class"

I'm running applications under XP. In my profile: I have a lot of problems double clicking on a jar file.... it always gives me this error: "could not find the main class"... In other XP profiles: All jar files run properly! Help me!Is your mani

Help needed with application: "could not find the main class"

I am pretty new to java and am trying to figure out applications a bit now. The one im working on does run within my editor, but when i "test" it or try to run it from within a .jar file it returns a "could not find the main class" err

Help Me Urgent...Error: "Could not find the main class. Program will exit."

Am using Eclipse 3.3.2 I have a project called: SWDS Initially i have JDK1.6 installed in my system. At this time the project is running succesfully. But when i removed(uninstalled and environment path also removed) JDK 1.6 and installed JDK 1.5 and

Installing Oracle client 10.2: Could not find the main class...

What should I configure on my PC to get Oracle Client for Win 32 working? When I try to install the client (10.2) setup.exe cannot start JVM and fails with the message Could not find the main class. I use Windows XP.Hello, What's version of Java inst

Could not find the OffLine WLST class (WL 10.3)

Hi, I am confused about this scenario, please help me. I keep getting the below when I run the wlst.sh script. Problem invoking WLST - java.lang.RuntimeException: Could not find the OffLine WLST class So what I did was add weblogic.jar to the classpa

OIM Installn :java.lang.RuntimeException: Could not find OffLine WLST class

Installation of OIM On weblogic. oracle/oim/xellerate/setup/setup.xml:443: The following error occurred while executing this line: /oracle/oim/xellerate/setup/weblogic-setup.xml:196: java.lang.RuntimeException: Could not find the OffLine WLST class  

My iTunes account sayscould not be used because the original file could not be found. Would you like to locate it? whenever i click on a song and i didn't move the songs anywhere. I don't know if i saved them to my hard drive so i can't find any songs

I downloaded something that was told to me to get to put some of my itunes songs onto my android phone. I think it synced my account, though. Whenever i click on a song an exclamation point comes up and something pops up and says "could not be used b

Your file could not be print due to an error on HP Deskjet PCL3 class driver on.

I purchase a new printer HP Deskjet Ink Advantage 1515, I successfully installed it but the problem while im trying to print the document is "Your file could not be print due to an error on HP DESKJET PCL3 Class driver on."Hi limarache, From wha

Could not find a part of the path 'C:\Program Files\Update Services\Schema\

clean SC 2012 R2 RTM. 1. had problems with WSUS installation/post configuration 2. found a blog with an identical problem where the problem was solved with the call to Microsoft. Tools directory was missing. I followed the suggestion: reinstalled WSU

Trouble creating a pdf converting Word doc ..."Could not find the application that created the file"

Hello, I am working with Acrobat Pro 8 and am trying to create a pdf by converting a word doc. When I try that, I keep getting an error message, " Could not find the application that created this file...please select a file created by an application

When I try to listen to a song I purchased last week, I get the message, "could not be used because the original file could not be found. would you like to locate it?" What do I do to find it?

When I try to listen to the songs I purchased from iTunes last week, I get the error message, "could not be used because the original file could not be found. would you like to locate it?"  What do I do to fix this problem or locate the song? Th

Recently in the Bahamas where I helped a friend with his new iPad. We could not find Bahamas in initial setup so we used United States and could not enter Visa/MC billing address in Bahamas. iTunes rejected, billing info is not what's on file. What to do?

Recently in the Bahamas where I helped a friend with his new iPad. We could not find Bahamas in initial setup so we used United States and could not enter Visa/MC billing address in Bahamas. iTunes rejected, billing info is not what's on file. What t

Could not find Patch CR112484_81sp1.jar for WEBLOGIC 8.1

Due problem with ACTUATE Server 7 WE have to install this patch but we could not find it ? Where is it on WL8.1 reference site ? ThanksHello, As these patch is not publically avialble through BEA Advisories....so you need to open a support case to ge

Error: Error writing stream: Could not find prefix for namespace:

Hi all, I am getting this error while doing topdownAssemble using WSA. The error seems as if the name space definitions do not have proper prefixs, but I have prefixes for all the name spaces. Any idea what else might be causing the problem ? Thanks,