Win a copy of Terraform in Action this week in the Cloud forum!

Henrique Aguiar

Greenhorn
+ Follow
since May 06, 2016
Henrique likes ...
Python Eclipse IDE Java
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Henrique Aguiar

I have just finished reading Head First Java. Since I'm a teen, I'd want to specialize in game making.
So, what Java book should I read now?
5 years ago
Um, no. The chapter is actually about RMI and servlets and stuff. But for some reason, the book basically assumes you already have a web server up and running without really explaining how to do that.
5 years ago
Well, the servers I have learned are basically just programs that keep waiting for clients to connect and send requests (through data streams). Is that what web servers are like?
5 years ago
It does explain how to write servers, only not web servers.
5 years ago

Knute Snortum wrote:I think the easiest way is to write or copy some code that uses a server, then in Eclipse, select Run -> Run As... -> Run on Server. If there are no servers, it will start a wizard that will take you through installation. Pick Tomcat 8.0, or the latest version.

Tomcat thingy


I think the best way to think about Tomcat at this point is, it is something that will turn your Java code into a website. So you don't have a main(), you have methods that react to HTTP requests. You don't run it by a java command, you launch it in a server (which has to be running).

Once you launch the Java code in a server, you will use your browser to view and react to the program. Usually the URL is something like localhost:8080/projectName.

I'm just scratching the surface here. This is something you should research a bit and play with a lot.


Thanks! But I'm still a bit confused regarding to the mechanics of web servers, Tomcat and servlets. Do you know any good tutorials that explain them (and how to use them) thoroughly?
5 years ago

Knute Snortum wrote:What's your environment? What, if any, IDE are you using? You would probably want to use Apache Tomcat as your servlet container and web server, but this is not beginner stuff! You might want to post another thread in the Servlets forum.



I use Eclipse. Could you point me to tutorials on how to use this Tomcat thingy?
Thanks
5 years ago

Henry Wong wrote:

Henrique Aguiar wrote:
Alright. I did see something similar somewhere along the internet. So, assuming I'm the administrator (or my parents are, but they won't know how to do this and I have basically access to configure whatever), how exactly would I have the port forwarded from the router to the machine?



Well, it depends on the router... Different routers have different administration setups. So, find the manual for your router first... but to answer your question, most routers support a web interface, so it is likely you will be using a browser to do it.

... and .... routers are generally password protected.... so, you will need to know that too. Now, if your parents don't know what the password is, then most likely you are using the default password. Take a look at the router manual for that as well.

Henry



To be more precise, the network is my phone's tethering, since we're don't have internet at home (because we're paying the hisa and stuff). So, how would I have the port forwarded if the hotspot is my phone?
5 years ago

Campbell Ritchie wrote:

Henrique Aguiar wrote:. . . My question is, should I skip this part then?

Yes.

Is it important for me to learn? . . .

No.

Many people no longer use RMI so you can ignore that section.



Right. What about the absolute last topic, which is about servlets? Apparently I'd need a web server running to follow through the tutorials. Should I skip them? Or set up a web server? If the latter, how do I do that?
5 years ago

Henry Wong wrote:

Henrique Aguiar wrote:I've made several networking apps, but due to the fact that I didn't have a different computer, I didn't get to test them. Now that I did, I've discovered my apps work just fine, if both PCs are on the same network. If I try to use them over different networks, they do not work. Why is that?



The IP addresses used in your example are reserved for private networks (most of them). Most likely you are behind a NAT'ed router. This kinda makes sense, as there is no reason to place all the computers in the library, university, home, etc. directly on the internet.

Unless, of course, you want the computers reachable from the outside. To do that, talk to your network administrator. You need to have the port forwarded from the router (internet connection) to the machine (on the private network) that you want. And you also need to change the code to connect to the router instead.

Henry



Alright. I did see something similar somewhere along the internet. So, assuming I'm the administrator (or my parents are, but they won't know how to do this and I have basically access to configure whatever), how exactly would I have the port forwarded from the router to the machine? And change the code to connect to the router? I'll only care for one of the networks for now, which is my house's network.
5 years ago
I've made several networking apps, but due to the fact that I didn't have a different computer, I didn't get to test them. Now that I did, I've discovered my apps work just fine, if both PCs are on the same network. If I try to use them over different networks, they do not work. Why is that?

Also, since my IP address (which I get from entering ipconfig in the command line) seems to be different over different networks, I have written this utility method which tries the most common IPs (that is, the IPs of the networks I most use) until it connects, and if non works, tries the local host:



However, is there a way to make my IP address, well, stay the same regardless of my network? That would be certainly helpful.

Please note I've quite little experience with Java and even less with network programming, so I might not understand some technical terms.

Thanks.
5 years ago
Hi. I've been reading Head First Java, and I've come to the last chapter, where it talks about RMI. But I have had some trouble, and I found this thread which roughly describes my problem: https://coderanch.com/t/659402/java/java/Remote-Deployment-RMI?nonMobile=true

So, apparently, the RMI part is really outdated. My question is, should I skip this part then? Is it important for me to learn?

Thanks.
5 years ago
Hi, I'm new to this forum so I'm really sorry if I'm breaking any rules or anything.

So, I'm currently reading Head First Java, and I'm on chapter 15 (looking at socket connections and threads). But to connect different computers to a server, I'd need to get the server's computer's IP address. So I searched up how to get it, and then I discovered I could try ipconfig in the command line. All good and well, it worked, I got to connect two laptops (one of them was running the server).
But a while later, when I restarted my computer in a different place, the client wasn't connecting to the server anymore. When I checked it, it appears that the IP address changed. But well, if my laptop will run the server, how can I get a fixed IP address that works all the time? I can't just pass a new version of my client (with the updated IP) to the other laptops all the time.