3 Replies - 3822 Views - Last Post: 09 December 2012 - 07:00 PM Rate Topic: -----

#1 timepuzzler   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 16
  • Joined: 25-November 11

Main method to create an executable

Posted 08 December 2012 - 09:06 AM

I have the code written for my last assignment.However, his instructions mention, "The file will contain a main() method which makes it an executable file." I've reviewed our material and found no references about using the main() method to make an executable. Can someone point me in the right direction on this? Below, you'll find my code so far.

public class Assign8
{
	public static void main(String[] args) throws IOException
	{
		String s1 = ("George");
		String s2 = ("Meghabghab");

		String s3 = s1.concat(s2);
		System.out.println(s3);

		String s4 = s2.substring(6);
		System.out.println(s4);

		String s5 = s2.substring(0, 2);
		System.out.println(s5);

		String s6 = s5.concat(s4.concat(s4));
		System.out.println(s6);

		boolean bool1 = (s2.equals(s6));
		System.out.println(bool1);

		String s7 = s1.substring(0, 1) + s2.substring(0, 1);
		System.out.println(s7);

		String s8 = new StringBuffer(s1).reverse().toString();
		System.out.println(s8);

		String s9 = new StringBuffer(s2).reverse().toString();
		System.out.println(s9);

		String s10 = s8.concat(s9);
		System.out.println(s10);

	}
}



Is This A Good Question/Topic? 0
  • +

Replies To: Main method to create an executable

#2 GregBrannon   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2250
  • View blog
  • Posts: 5,340
  • Joined: 10-September 10

Re: Main method to create an executable

Posted 08 December 2012 - 09:13 AM

I believe the main() method you have complies with the instructions, at least as you've given them to us. I don't think the instructor meant an executable file as in an .exe file, but rather that the file could be compiled and run as a .class file.
Was This Post Helpful? 1
  • +
  • -

#3 g00se   User is offline

  • D.I.C Lover
  • member icon

Reputation: 3744
  • View blog
  • Posts: 17,121
  • Joined: 20-September 08

Re: Main method to create an executable

Posted 08 December 2012 - 09:18 AM

Quote

I don't think the instructor meant an executable file as in an .exe file, but rather that the file could be compiled and run as a .class file.
Greg means run as an application

This post has been edited by g00se: 08 December 2012 - 09:19 AM
Reason for edit:: typo

Was This Post Helpful? 1
  • +
  • -

#4 pbl   User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8381
  • View blog
  • Posts: 31,956
  • Joined: 06-March 08

Re: Main method to create an executable

Posted 09 December 2012 - 07:00 PM

EXE4J expects a .jar as input
this .jar should contain:
- all the .classes of your application
- all the .classes of all the librairies you call...

just extract all the .classes from the .jar you use and put them into the one you use as input the EXE4J
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1