Problem about .java file and email

  • Java
  • Thread starter kant
  • Start date
  • Tags
    Email File
In summary, the conversation revolves around the sender trying to send a .java file as an attachment in an email to their professor. However, the recipient only sees the java code in plain text format and the sender wants the recipient to open the attachment and automatically invoke their java compiler. The solution proposed is for the sender to have the recipient copy and paste the code into a text editor and save it as a .java file. However, the professor may not want to do this as it could be a security violation. Another possible solution is for the webserver and web browser to be configured to handle specific file types and programs. It is also suggested that the sender cannot mandate the recipient to open the .java file with a Java compiler, only
  • #1
kant
388
0
I am trying to send a .java file as an attachment in my email. the problem is that when guy who received my email open his email, all he see s is the java code in plan text format. I want the person who received my email to open the attachment, and automatically invoke his java compiler, and my java code in his java compiler screen. what do i need in order to do this?
 
Technology news on Phys.org
  • #2
You could always have your friend copy the "text" (your code) from the e-mail, and then open the program notepad (or another text editor), paste the text, and then save it as a .java file.
 
  • #3
mattmns said:
You could always have your friend copy the "text" (your code) from the e-mail, and then open the program notepad (or another text editor), paste the text, and then save it as a .java file.

this "guy" is actually my professor. He doesn t want to copy and paste, because he said so in class.
 
  • #4
kant said:
I am trying to send a .java file as an attachment in my email. the problem is that when guy who received my email open his email, all he see s is the java code in plan text format. I want the person who received my email to open the attachment, and automatically invoke his java compiler, and my java code in his java compiler screen. what do i need in order to do this?

The webserver might have to be set with a mime type for java.

In addition, the recipient's webbrowser might have to be configured to handle specific filetypes with specific programs.

Some email-clients might regard the ability to invoke a java compiler like that as a security violation. (Java programs are more dangerous than java applets.)

As far as I can tell, there is nothing that you, the sender, can do alone.

kant said:
this "guy" is actually my professor. He doesn t want to copy and paste, because he said so in class.
Has your professor been successful with submissions from other students but not from you?
 
  • #5
There's no way for YOU, the sender, to mandate that the receiver open your .java file with a Java compiler. Only the RECEIVER can set such preferences.

- Warren
 
  • #6
Maybe he wants you to send it as a compiled jar?
 

1. What is a .java file and why is it important?

A .java file is a source code file used in Java programming language. It contains instructions written in the Java programming language that are used to create a software application. .java files are important because they serve as the starting point for creating and running a Java program.

2. How do I open and edit a .java file?

To open and edit a .java file, you will need a text editor or an integrated development environment (IDE) such as Eclipse or NetBeans. Simply open the .java file with the text editor or IDE of your choice and you will be able to view and make changes to the code.

3. Can I send a .java file through email?

Yes, you can send a .java file through email just like any other file. However, be aware that some email clients may block or flag .java files as potentially harmful attachments. It is recommended to compress the .java file into a zip folder before sending it via email.

4. How do I run a .java file?

To run a .java file, you will need to compile it into a .class file first. This can be done using a Java compiler or through the command line. Once the .class file is generated, you can run it using the command "java [filename]" in the same directory where the .class file is located.

5. What should I do if I receive an error while trying to compile or run a .java file?

If you encounter an error while compiling or running a .java file, check the code for any syntax errors or missing semicolons. If the code looks correct, try restarting your IDE or computer. If the error persists, you can search for the specific error message online or seek help from a more experienced Java programmer.

Similar threads

  • Programming and Computer Science
Replies
8
Views
1K
  • Programming and Computer Science
Replies
1
Views
798
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
3
Views
4K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
4
Views
3K
  • Programming and Computer Science
Replies
8
Views
2K
  • Programming and Computer Science
Replies
12
Views
9K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
Replies
14
Views
1K
Back
Top