1
I managed to open a file and put it on a Jlabel on the machine where I am developing. But when I put the application on the network the machine that is on the network, it does not locate the file. Is it possible to get the file from a networked machine? My code is as follows and works perfectly on my machine that I am developing.
String figura = jtResultadoPesquisa.getValueAt(jtResultadoPesquisa.getSelectedRow(), 0).toString(); // quardo o nome do arquivo na figura
String caminho = new File("/home/Pictures/").getCanonicalPath(); // pego o diretorio onde esta o arquivo
ResultadoCaminhoFigura = caminho +"/"+ figura; // tenho o caminho com a figura
ImageIcon img = new ImageIcon (ResultadoCaminhoFigura); //crio uma instancia e coloco a figura e diretorio onde ela se localiza
img.setImage(img.getImage().getScaledInstance(300, 430, 100));
jlVisualisarimagem.setIcon(img); // e seto a figura em um jlabel para ser visualizada.
jlVisualisarimagem.setHorizontalAlignment(JLabel.CENTER);
jspVisualizarimagem.getViewport().add(jlVisualisarimagem);
I posted the comments just to facilitate understanding. When I run on my machine it works cool, but when I networked the application it does not bring the image. Could someone help me? Hugs to all.
G Zullian, besides doing that you put I had to share the folder that is on the server. Since the server is I installed samba, I shared the folder and used the ip address you described to locate the shared folder on the server. Thanks. Thank you so much for your help.
– Ramilton Costa Gomes Junior
Exactly, when I talked about permissions and other settings, that’s what it was all about. Glad you made it, I ask you to accept the answer to help other users. Hug!
– Zulian