Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

This will work bt i want external USB device path then what should we do??
- Mayuri
Does getAbsolutePath has to resolve symbolic links? According to this article resolving symbolic links (which always is system dependent) does only happen when calling getCanonicalPath, but a simple test case shows that getAbsolutePath also resolves symbolic links. Do you have more information about this?
- Tristan
Hi Sir, I am trying to get the full path of the selected file. Below is the code. Please advise. I need to pass the full path and file name for the selected files to apache pdf box class to get the excel extracts. /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.pdfet.pdfext; import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.awt.event.ActionListener; //import com.pdfet.pdfext.ExtensionFileFilter; import java.io.File; import javax.swing.filechooser.FileFilter; /** * * @author vak_salem */ class ExtensionFileFilter extends FileFilter { String descrip; String extn[]; public ExtensionFileFilter(String descrip,String Extn) { this(descrip,new String[] {Extn}); } public ExtensionFileFilter(String descrip, String extn[]) { if (descrip==null) { this.descrip=extn[0] + “{”+ extn.length + “}”; } else { this.descrip=descrip; } this.extn=(String []) extn.clone(); toLower(this.extn); } private void toLower(String array[]) { for (int i=0,n=array.length;i<n;i++) { array[i]=array[i].toLowerCase(); } // return (array.toString()); } public String getDescription() { return descrip; } public boolean accept(File file) { if (file.isDirectory()) { return true; } else { String path = file.getAbsolutePath().toLowerCase(); for (int i = 0, n = extn.length; i < n; i++) { String ex = extn[i]; if ((path.endsWith(ex) && (path.charAt(path.length() - ex.length() - 1)) == ‘.’)) { return true; } } } return false; } } public class Jcustomfhooser{ public static void main(String args[]) { JFrame frame=new JFrame(“PDF2Excel”); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(700, 700); //JPanel panel=new JPanel(); JLabel label=new JLabel(“Upload file and click Submit”); Container pane= frame.getContentPane(); JFileChooser jfc =new JFileChooser(“UploadFile”); jfc.setMultiSelectionEnabled(true); // FileFilter pdffilter=new ExtensionFileFilter(null,new String[] {“PDF”}); //ExtUI ex=new ExtUI(); //String outstr; //ExtensionFileFilter ex=new ExtensionFileFilter(); FileFilter filter= new ExtensionFileFilter(null,new String[] {“pdf”}); // FileFilter pdffilter=new ExtensionFileFilter //jfc.setFileSelectionMode(JFileChooser.; jfc.setFileFilter(filter); //jfc.addChoosableFileFilter(filter); JButton button=new JButton(“Select Files…”); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int retval=jfc.showOpenDialog(frame); if (retval==JFileChooser.APPROVE_OPTION) { //File file=new File(); } File[] selectedfiles =jfc.getSelectedFiles(); StringBuilder sb=new StringBuilder(); for (int i=0;i<selectedfiles.length;i++) { sb.append( selectedfiles[i].getName()); // selectedfiles[i]. getName()+ “\n”); } JOptionPane.showMessageDialog(frame, sb.toString()); } } }); //jfc.showOpenDialog(null); pane.setLayout(new GridLayout(3,1,10,10)); pane.add(label); //panel.add(jfc); pane.add(button); //frame.getContentPane().add(BorderLayout.NORTH,panel); //frame.getContentPane().add(BorderLayout.WEST,) frame.setSize(200, 200); frame.setVisible(true); } }
- Arun