Would someone please be able to explain to me how to properly install JavaMail and have it to execute in Eclipse please.
I have been trying for the past few hours and I am completely lost as to why this is.
This is from trying to execute their demo projects msgsend.java and msgshow.java.
I either find an error message stating invalid protocol or could not connecto to SMTP host: localhost, port 25;
What I suggest.
Open Eclipse
Create a new Java project
Create a new Java class which contains a main method (entry point)
Create a folder "libs" inside which you put your JavaMail jar library and other external dependencies
Right-click (from within eclipse) on the added JavaMail jar file and choose Build path and add to build path.
Now you project should be ok in terms of dependencies and you can start coding your test logic within your main method or other classes you create
Once coded, Run your project, by right-clicking on the class which represents your app's entry point and select Run and run as Java application
(That's all I can provide given the details in your question ;) )
If you're running the examples and it's using "localhost:25" as the server, you'll need to have an SMTP server running on the same machine.
If you don't have a local SMTP server, then try replacing "localhost" with the SMTP server hostname that your ISP provides you.
If you are getting an exception being thrown which is stating that it could not correct to an SMTP host (it may be helpful if you posted the exact error) that means that Javamail is correctly installed in your classpath but that it could not find the given SMTP host.
Keep in mind that by merely dropping Javamail into Eclipse will not automatically result in an SMTP server running on localhost (aka your own machine).
So, either set up an SMTP server on your machine or just use your ISP's server for test purposes.
I would suggest the later, but if you are interested in the former, you may want to check out:
http://www.ericdaugherty.com/java/mailserver/
It includes an Eclipse plugin.
Related
Im using eclipse Neon and working behind a proxy. Below message boxes are displayed when im trying to create a maven project using an archetype.
"Could not resolve archetype XXXXXXXX from any of the configured repositories."
"Creating xxxxx has encountered a problem. Could not resolve archetype xxxx from any of the configured repositories"
I have configured the below settings correctly.
1. Proxy settings in Eclipse
2. Proxy settings in maven setting.xml file
3. Add the remote catalog as "http://repo1.maven.org/maven2/archetype-catalog.xml"
However, when i go to error description, it says "unexpected end of stream on connection" and it shows my proxy IP and port. Just to check, i have altered proxy IP in the setting.xml file and eclipse proxy setting but it shows the same IP and PORT in the error description without any change. I have no idea from where maven refers the proxy settings. Please advice.
Thanks in Advance
The same error made me struggle alot, I could download testNG and other things from eclipse marketplace, but when i'm creating a maven project i got this error. Because my internet connection is going through proxy.
I tried all the above but i couldn't resolve this error, but this guy gave me the solution:
http://www.javahelps.com/2015/08/set-proxy-for-maven-in-eclipse.html
After the above procedure is done, then you have to delete the existing quickstart-archetype from below folder
C:\Users.m2\repository\org\apache\maven\archetypes
then restart the eclipse and create a new maven project with new project name.
Since this is only a proxy issue, so no need to specify the arche types and all. This should work if it's a proxy related issue.
Try the following :
1) Delete your repository at C:/Users/????/.m2/repository
2) Check your C:/Users/????/.m2/settings.xml for correct proxy config
3) Set you M2_HOME environment variable to <MAVEN INSTALL DIR
4) Add %M2_HOME%/bin: to your PATH variable assuming windows (remeber to start a new window after changing ebvironment variables)
5) Try a mvn clean install from the command line - GET THIS WORKING FIRST
6) Then try from netbeans, you do not need a proxy setting it should call the default mvn.
Set proxy setting in eclipse neon as follows:
Window->Preferences->General->Network Connection
Now select Active Provider as Manual.
Now you will get three proxy entries to be configured HTTP, HTTPS and SOCKS. Configure host name, port, username and password in HTTP and HTTPS proxy entries, but not in SOCKS. Try this, it may help.
Also make sure the username and password you are typing is correct.
After configuration please restart eclipse, it is required for taking the effect of configuration.
Proxy setting in .m2/settings.xml may not be required after above setting.
I had a problem a couple of days ago where I was getting a Permission denied: connect when using Javamail to send an e-mail using our local mail server. For reference it can be found here: JavaMail API to iMail -- java.net.SocketException: Permission denied: connect. The solution was to add "-Djava.net.preferIPv4Stack=true" to my project's VM Options.
I'm getting the same error codes after building the project and trying to run the .jar file outside of NetBeans. The project works as intended from inside the NetBeans IDE.
I have searched around the questions here, Google, and read through some Javamail FAQs. To be honest, I really don't know what I am looking for and figure that I am just missing something.
I'm using NetBeans 7.2, Java 7, and Windows 7. The dist folder for my project has the .jar file and the dist\lib folder contains mail.jar.
Any ideas on why I would be getting that error again? Thank you again for any help/information.
How are you running your program?
If you run it with "java -jar myprog.jar", use "java -Djava.net.preferIPv4Stack=tru -jar myprog.jar".
If you run it by double clicking the jar file or something like that, you might need to set the property in your code, by adding System.setProperty("java.net.preferIPv4Stack", "true");
Brief: How to setup a project on a remote server?
I have been trying to work on Java code on a remote server by logging into it using Putty on windows and editing it using a basic text editor. I intend to move to Eclipse/Remote system explorer. I did just that and I could use Eclipse as an editor, but compile on the remote server.
Problem:
1. I am trying to get the features of Eclipse where it suggests me the available methods for a n object; however, I get this error: This compilation unit is not in the build path of a java project"
As I understand, I haven't set it up as a project. Can someone point me in the right direction?
Thanks.
I personally haven't tried that , but this could be useful to you :)
http://www.patrickjwaters.com/blog/2011-07-24/how-setup-eclipse-php-pdt-remote-system-explorer-theme-manager-and-drupal-plugins/35
I've got some existing source code, and jars for a webapp. I am attempting to run the webabb using tomcat and then remote debugging the tomcat server using eclipse to figure out what is happening with the webapp.
For some reason however, eclipse refuses to trap any breakpoints. I've compared the md5sums of the jars on the server with the ones I've got in my debug project, and they match.
Is there some way I can ask eclipse to reconcile the java classes in the remote JVM with the java classes in the local jars and make sure they correspond. Or, perhaps, more specifically, whether the code associated with breakpoints I've set have actually be loaded into the remote JVM?
Check that on the Java Compiler properties page for the java projects in question that the class file options are all checked (you only need the first three but having all five checked is a good thing for debugging)
I'm trying to move our Google Web Toolkit (GWT) development from Eclipse to IntelliJ 9 Community edition. So far I've been able to run and debug client/server code successfully via the GWT Maven plugin and its embedded Jetty container.
However, I'm having trouble debugging client code when it is already running on a remote machine (and hence there's no need for the embedded Jetty container).
Has anyone been successful at achieving this? Any help would be appreciated!
UPDATE: I was finally able to accomplish this. Please see my own answer below...
I was finally able to accomplish this by using GWT's DevMode class, as described in the documentation.
In short -
Add your project to IntelliJ 9 Community edition
Add an Application run/debug configuration
Use com.google.gwt.dev.DevMode as your main class (make sure to include gwt-user and gwt-dev jars to the project classpath. See here)
Add the following program parameters:
-noserver -war "[full path to your exploded war]" -gen "[full path to generated files]" -logLevel INFO -port [remote server port] -startupUrl "[URL of the remote page]" [com.company.YourEntryPoint]
This way, the DevMode runner will not instantiate the built in container and will allow your remote server's JavaScript to be debugged in its original Java form.
Note that for builds that don't require debugging remote client code you may use Maven or Ant integration, which is much simpler. I don't have any experience with the webAppCreator generated build.xml, but with Maven you could simply run the gwt:run or gwt:debug goals with this parameter: -DrunTarget=
Hope it helps!
When running a GWT app deployed on a remote server, the client part of your app will have been translated into javascript so I do not think you will be able to debug this from IntelliJ. The server side part of your app will still be Java code. You should be able to start up this remote server with java debugging parameters (things like a transporttype and a port to listen to). From IntelliJ, you should be able to start up a remote debugging session using the same transporttype and port.
If you look into remote debugging, you should be able to find how to do this.